Skip to content

Commit d3dd07e

Browse files
committed
Revert "[profile] Fix profile merging with binary IDs"
This reverts commit dcadd64.
1 parent dfb6f7b commit d3dd07e

File tree

14 files changed

+25
-43
lines changed

14 files changed

+25
-43
lines changed

compiler-rt/include/profile/InstrProfData.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ INSTR_PROF_VALUE_NODE(PtrToNodeT, llvm::Type::getInt8PtrTy(Ctx), Next, \
127127
#endif
128128
INSTR_PROF_RAW_HEADER(uint64_t, Magic, __llvm_profile_get_magic())
129129
INSTR_PROF_RAW_HEADER(uint64_t, Version, __llvm_profile_get_version())
130-
INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
131130
INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
132131
INSTR_PROF_RAW_HEADER(uint64_t, PaddingBytesBeforeCounters, PaddingBytesBeforeCounters)
133132
INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)
@@ -137,6 +136,7 @@ INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta,
137136
(uintptr_t)CountersBegin - (uintptr_t)DataBegin)
138137
INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin)
139138
INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)
139+
INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
140140
#undef INSTR_PROF_RAW_HEADER
141141
/* INSTR_PROF_RAW_HEADER end */
142142

@@ -645,7 +645,7 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
645645
(uint64_t)'f' << 16 | (uint64_t)'R' << 8 | (uint64_t)129
646646

647647
/* Raw profile format version (start from 1). */
648-
#define INSTR_PROF_RAW_VERSION 7
648+
#define INSTR_PROF_RAW_VERSION 6
649649
/* Indexed profile format version (start from 1). */
650650
#define INSTR_PROF_INDEX_VERSION 7
651651
/* Coverage mapping format version (start from 0). */

compiler-rt/lib/profile/InstrProfilingBuffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ uint64_t __llvm_profile_get_size_for_buffer_internal(
116116
DataSize, CountersSize, NamesSize, &PaddingBytesBeforeCounters,
117117
&PaddingBytesAfterCounters, &PaddingBytesAfterNames);
118118

119-
return sizeof(__llvm_profile_header) + __llvm_write_binary_ids(NULL) +
119+
return sizeof(__llvm_profile_header) +
120120
(DataSize * sizeof(__llvm_profile_data)) + PaddingBytesBeforeCounters +
121121
(CountersSize * sizeof(uint64_t)) + PaddingBytesAfterCounters +
122122
NamesSize + PaddingBytesAfterNames;

compiler-rt/lib/profile/InstrProfilingMerge.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ void (*VPMergeHook)(ValueProfData *, __llvm_profile_data *);
2222
COMPILER_RT_VISIBILITY
2323
uint64_t lprofGetLoadModuleSignature() {
2424
/* A very fast way to compute a module signature. */
25-
uint64_t Version = __llvm_profile_get_version();
2625
uint64_t CounterSize = (uint64_t)(__llvm_profile_end_counters() -
2726
__llvm_profile_begin_counters());
2827
uint64_t DataSize = __llvm_profile_get_data_size(__llvm_profile_begin_data(),
@@ -34,7 +33,7 @@ uint64_t lprofGetLoadModuleSignature() {
3433
const __llvm_profile_data *FirstD = __llvm_profile_begin_data();
3534

3635
return (NamesSize << 40) + (CounterSize << 30) + (DataSize << 20) +
37-
(NumVnodes << 10) + (DataSize > 0 ? FirstD->NameRef : 0) + Version;
36+
(NumVnodes << 10) + (DataSize > 0 ? FirstD->NameRef : 0);
3837
}
3938

4039
/* Returns 1 if profile is not structurally compatible. */
@@ -45,8 +44,7 @@ int __llvm_profile_check_compatibility(const char *ProfileData,
4544
__llvm_profile_header *Header = (__llvm_profile_header *)ProfileData;
4645
__llvm_profile_data *SrcDataStart, *SrcDataEnd, *SrcData, *DstData;
4746
SrcDataStart =
48-
(__llvm_profile_data *)(ProfileData + sizeof(__llvm_profile_header) +
49-
Header->BinaryIdsSize);
47+
(__llvm_profile_data *)(ProfileData + sizeof(__llvm_profile_header));
5048
SrcDataEnd = SrcDataStart + Header->DataSize;
5149

5250
if (ProfileSize < sizeof(__llvm_profile_header))
@@ -65,7 +63,7 @@ int __llvm_profile_check_compatibility(const char *ProfileData,
6563
Header->ValueKindLast != IPVK_Last)
6664
return 1;
6765

68-
if (ProfileSize < sizeof(__llvm_profile_header) + Header->BinaryIdsSize +
66+
if (ProfileSize < sizeof(__llvm_profile_header) +
6967
Header->DataSize * sizeof(__llvm_profile_data) +
7068
Header->NamesSize + Header->CountersSize)
7169
return 1;
@@ -102,8 +100,7 @@ int __llvm_profile_merge_from_buffer(const char *ProfileData,
102100
uintptr_t CountersDelta = Header->CountersDelta;
103101

104102
SrcDataStart =
105-
(__llvm_profile_data *)(ProfileData + sizeof(__llvm_profile_header) +
106-
Header->BinaryIdsSize);
103+
(__llvm_profile_data *)(ProfileData + sizeof(__llvm_profile_header));
107104
SrcDataEnd = SrcDataStart + Header->DataSize;
108105
SrcCountersStart = (uint64_t *)SrcDataEnd;
109106
SrcNameStart = (const char *)(SrcCountersStart + Header->CountersSize);

compiler-rt/test/profile/Linux/binary-id.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@
1010
// RUN: llvm-profdata show --binary-ids %t.profraw > %t.profraw.out
1111
// RUN: FileCheck %s --check-prefix=BINARY-ID-RAW-PROF < %t.profraw.out
1212

13-
// RUN: rm -rf %t.profdir
14-
// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
15-
// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
16-
// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
17-
// RUN: llvm-profdata show --binary-ids %t.profdir/default_*.profraw > %t.profraw.out
18-
// RUN: FileCheck %s --check-prefix=BINARY-ID-MERGE-PROF < %t.profraw.out
19-
2013
void foo() {
2114
}
2215

@@ -41,10 +34,3 @@ int main() {
4134
// BINARY-ID-RAW-PROF-NEXT: Maximum internal block count: 0
4235
// BINARY-ID-RAW-PROF-NEXT: Binary IDs:
4336
// BINARY-ID-RAW-PROF-NEXT: {{[0-9a-f]+}}
44-
45-
// BINARY-ID-MERGE-PROF: Instrumentation level: Front-end
46-
// BINARY-ID-MERGE-PROF-NEXT: Total functions: 3
47-
// BINARY-ID-MERGE-PROF-NEXT: Maximum function count: 3
48-
// BINARY-ID-MERGE-PROF-NEXT: Maximum internal block count: 0
49-
// BINARY-ID-MERGE-PROF-NEXT: Binary IDs:
50-
// BINARY-ID-MERGE-PROF-NEXT: {{[0-9a-f]+}}

llvm/include/llvm/ProfileData/InstrProf.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,6 @@ namespace RawInstrProf {
11041104
// Version 5: Bit 60 of FuncHash is reserved for the flag for the context
11051105
// sensitive records.
11061106
// Version 6: Added binary id.
1107-
// Version 7: Reorder binary id and include version in signature.
11081107
const uint64_t Version = INSTR_PROF_RAW_VERSION;
11091108

11101109
template <class IntPtrT> inline uint64_t getMagic();

llvm/include/llvm/ProfileData/InstrProfData.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ INSTR_PROF_VALUE_NODE(PtrToNodeT, llvm::Type::getInt8PtrTy(Ctx), Next, \
127127
#endif
128128
INSTR_PROF_RAW_HEADER(uint64_t, Magic, __llvm_profile_get_magic())
129129
INSTR_PROF_RAW_HEADER(uint64_t, Version, __llvm_profile_get_version())
130-
INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
131130
INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
132131
INSTR_PROF_RAW_HEADER(uint64_t, PaddingBytesBeforeCounters, PaddingBytesBeforeCounters)
133132
INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)
@@ -137,6 +136,7 @@ INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta,
137136
(uintptr_t)CountersBegin - (uintptr_t)DataBegin)
138137
INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin)
139138
INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)
139+
INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
140140
#undef INSTR_PROF_RAW_HEADER
141141
/* INSTR_PROF_RAW_HEADER end */
142142

@@ -645,7 +645,7 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
645645
(uint64_t)'f' << 16 | (uint64_t)'R' << 8 | (uint64_t)129
646646

647647
/* Raw profile format version (start from 1). */
648-
#define INSTR_PROF_RAW_VERSION 7
648+
#define INSTR_PROF_RAW_VERSION 6
649649
/* Indexed profile format version (start from 1). */
650650
#define INSTR_PROF_INDEX_VERSION 7
651651
/* Coverage mapping format version (start from 0). */

llvm/lib/ProfileData/InstrProfReader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,6 @@ Error RawInstrProfReader<IntPtrT>::readHeader(
366366
if (GET_VERSION(Version) != RawInstrProf::Version)
367367
return error(instrprof_error::unsupported_version);
368368

369-
BinaryIdsSize = swap(Header.BinaryIdsSize);
370369
CountersDelta = swap(Header.CountersDelta);
371370
NamesDelta = swap(Header.NamesDelta);
372371
auto DataSize = swap(Header.DataSize);
@@ -375,6 +374,7 @@ Error RawInstrProfReader<IntPtrT>::readHeader(
375374
auto PaddingBytesAfterCounters = swap(Header.PaddingBytesAfterCounters);
376375
NamesSize = swap(Header.NamesSize);
377376
ValueKindLast = swap(Header.ValueKindLast);
377+
BinaryIdsSize = swap(Header.BinaryIdsSize);
378378

379379
auto DataSizeInBytes = DataSize * sizeof(RawInstrProf::ProfileData<IntPtrT>);
380380
auto PaddingSize = getNumPaddingBytes(NamesSize);
Binary file not shown.

llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22
//
33
// INSTR_PROF_RAW_HEADER(uint64_t, Magic, __llvm_profile_get_magic())
44
// INSTR_PROF_RAW_HEADER(uint64_t, Version, __llvm_profile_get_version())
5-
// INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
65
// INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
76
// INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)
87
// INSTR_PROF_RAW_HEADER(uint64_t, NamesSize, NamesSize)
98
// INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta, (uintptr_t)CountersBegin)
109
// INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin)
1110
// INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)
11+
// INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
1212

1313
RUN: printf '\201rforpl\377' > %t.profraw
14-
RUN: printf '\7\0\0\0\0\0\0\0' >> %t.profraw
15-
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
14+
RUN: printf '\6\0\0\0\0\0\0\0' >> %t.profraw
1615
RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
1716
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
1817
RUN: printf '\2\0\0\0\0\0\0\0' >> %t.profraw
@@ -21,6 +20,7 @@ RUN: printf '\10\0\0\0\0\0\0\0' >> %t.profraw
2120
RUN: printf '\0\0\6\0\1\0\0\0' >> %t.profraw
2221
RUN: printf '\0\0\6\0\2\0\0\0' >> %t.profraw
2322
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
23+
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
2424

2525
// Data Section
2626
//

llvm/test/tools/llvm-profdata/raw-32-bits-be.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
RUN: printf '\377lprofR\201' > %t
2-
RUN: printf '\0\0\0\0\0\0\0\7' >> %t
3-
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
2+
RUN: printf '\0\0\0\0\0\0\0\6' >> %t
43
RUN: printf '\0\0\0\0\0\0\0\2' >> %t
54
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
65
RUN: printf '\0\0\0\0\0\0\0\3' >> %t
@@ -9,6 +8,7 @@ RUN: printf '\0\0\0\0\0\0\0\20' >> %t
98
RUN: printf '\0\0\0\0\1\0\0\0' >> %t
109
RUN: printf '\0\0\0\0\2\0\0\0' >> %t
1110
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
11+
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
1212

1313
RUN: printf '\134\370\302\114\333\030\275\254' >> %t
1414
RUN: printf '\0\0\0\0\0\0\0\1' >> %t

llvm/test/tools/llvm-profdata/raw-32-bits-le.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
RUN: printf '\201Rforpl\377' > %t
2-
RUN: printf '\7\0\0\0\0\0\0\0' >> %t
3-
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
2+
RUN: printf '\6\0\0\0\0\0\0\0' >> %t
43
RUN: printf '\2\0\0\0\0\0\0\0' >> %t
54
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
65
RUN: printf '\3\0\0\0\0\0\0\0' >> %t
@@ -9,6 +8,7 @@ RUN: printf '\20\0\0\0\0\0\0\0' >> %t
98
RUN: printf '\0\0\0\1\0\0\0\0' >> %t
109
RUN: printf '\0\0\0\2\0\0\0\0' >> %t
1110
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
11+
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
1212

1313
RUN: printf '\254\275\030\333\114\302\370\134' >> %t
1414
RUN: printf '\1\0\0\0\0\0\0\0' >> %t

llvm/test/tools/llvm-profdata/raw-64-bits-be.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
RUN: printf '\377lprofr\201' > %t
2-
RUN: printf '\0\0\0\0\0\0\0\7' >> %t
3-
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
2+
RUN: printf '\0\0\0\0\0\0\0\6' >> %t
43
RUN: printf '\0\0\0\0\0\0\0\2' >> %t
54
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
65
RUN: printf '\0\0\0\0\0\0\0\3' >> %t
@@ -9,6 +8,7 @@ RUN: printf '\0\0\0\0\0\0\0\20' >> %t
98
RUN: printf '\0\0\0\1\0\4\0\0' >> %t
109
RUN: printf '\0\0\0\2\0\4\0\0' >> %t
1110
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
11+
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
1212

1313
RUN: printf '\134\370\302\114\333\030\275\254' >> %t
1414
RUN: printf '\0\0\0\0\0\0\0\1' >> %t

llvm/test/tools/llvm-profdata/raw-64-bits-le.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
RUN: printf '\201rforpl\377' > %t
2-
RUN: printf '\7\0\0\0\0\0\0\0' >> %t
3-
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
2+
RUN: printf '\6\0\0\0\0\0\0\0' >> %t
43
RUN: printf '\2\0\0\0\0\0\0\0' >> %t
54
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
65
RUN: printf '\3\0\0\0\0\0\0\0' >> %t
@@ -9,6 +8,7 @@ RUN: printf '\20\0\0\0\0\0\0\0' >> %t
98
RUN: printf '\0\0\4\0\1\0\0\0' >> %t
109
RUN: printf '\0\0\4\0\2\0\0\0' >> %t
1110
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
11+
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
1212

1313
RUN: printf '\254\275\030\333\114\302\370\134' >> %t
1414
RUN: printf '\1\0\0\0\0\0\0\0' >> %t

llvm/test/tools/llvm-profdata/raw-two-profiles.test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
RUN: printf '\201rforpl\377' > %t-foo.profraw
2-
RUN: printf '\7\0\0\0\0\0\0\0' >> %t-foo.profraw
3-
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
2+
RUN: printf '\6\0\0\0\0\0\0\0' >> %t-foo.profraw
43
RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw
54
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
65
RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw
@@ -9,6 +8,7 @@ RUN: printf '\10\0\0\0\0\0\0\0' >> %t-foo.profraw
98
RUN: printf '\0\0\4\0\1\0\0\0' >> %t-foo.profraw
109
RUN: printf '\0\0\4\0\2\0\0\0' >> %t-foo.profraw
1110
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
11+
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
1212

1313
RUN: printf '\254\275\030\333\114\302\370\134' >> %t-foo.profraw
1414
RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw
@@ -21,8 +21,7 @@ RUN: printf '\023\0\0\0\0\0\0\0' >> %t-foo.profraw
2121
RUN: printf '\3\0foo\0\0\0' >> %t-foo.profraw
2222

2323
RUN: printf '\201rforpl\377' > %t-bar.profraw
24-
RUN: printf '\7\0\0\0\0\0\0\0' >> %t-bar.profraw
25-
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
24+
RUN: printf '\6\0\0\0\0\0\0\0' >> %t-bar.profraw
2625
RUN: printf '\1\0\0\0\0\0\0\0' >> %t-bar.profraw
2726
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
2827
RUN: printf '\2\0\0\0\0\0\0\0' >> %t-bar.profraw
@@ -31,6 +30,7 @@ RUN: printf '\10\0\0\0\0\0\0\0' >> %t-bar.profraw
3130
RUN: printf '\0\0\6\0\1\0\0\0' >> %t-bar.profraw
3231
RUN: printf '\0\0\6\0\2\0\0\0' >> %t-bar.profraw
3332
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
33+
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
3434

3535
RUN: printf '\067\265\035\031\112\165\023\344' >> %t-bar.profraw
3636
RUN: printf '\02\0\0\0\0\0\0\0' >> %t-bar.profraw

0 commit comments

Comments
 (0)