mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-20 18:27:20 +00:00
Revert "[profile] Fix profile merging with binary IDs"
This reverts commit 89d6eb6f8c5d94093f30a5f37b193a2422491642, this seemed to have break a few builders.
This commit is contained in:
parent
b5b023638a
commit
6ea2f31f3d
@ -127,7 +127,6 @@ INSTR_PROF_VALUE_NODE(PtrToNodeT, llvm::Type::getInt8PtrTy(Ctx), Next, \
|
||||
#endif
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, Magic, __llvm_profile_get_magic())
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, Version, __llvm_profile_get_version())
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, PaddingBytesBeforeCounters, PaddingBytesBeforeCounters)
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)
|
||||
@ -137,6 +136,7 @@ INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta,
|
||||
(uintptr_t)CountersBegin - (uintptr_t)DataBegin)
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin)
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
|
||||
#undef INSTR_PROF_RAW_HEADER
|
||||
/* INSTR_PROF_RAW_HEADER end */
|
||||
|
||||
@ -645,7 +645,7 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
|
||||
(uint64_t)'f' << 16 | (uint64_t)'R' << 8 | (uint64_t)129
|
||||
|
||||
/* Raw profile format version (start from 1). */
|
||||
#define INSTR_PROF_RAW_VERSION 7
|
||||
#define INSTR_PROF_RAW_VERSION 6
|
||||
/* Indexed profile format version (start from 1). */
|
||||
#define INSTR_PROF_INDEX_VERSION 7
|
||||
/* Coverage mapping format version (start from 0). */
|
||||
|
@ -116,7 +116,7 @@ uint64_t __llvm_profile_get_size_for_buffer_internal(
|
||||
DataSize, CountersSize, NamesSize, &PaddingBytesBeforeCounters,
|
||||
&PaddingBytesAfterCounters, &PaddingBytesAfterNames);
|
||||
|
||||
return sizeof(__llvm_profile_header) + __llvm_write_binary_ids(NULL) +
|
||||
return sizeof(__llvm_profile_header) +
|
||||
(DataSize * sizeof(__llvm_profile_data)) + PaddingBytesBeforeCounters +
|
||||
(CountersSize * sizeof(uint64_t)) + PaddingBytesAfterCounters +
|
||||
NamesSize + PaddingBytesAfterNames;
|
||||
|
@ -22,7 +22,6 @@ void (*VPMergeHook)(ValueProfData *, __llvm_profile_data *);
|
||||
COMPILER_RT_VISIBILITY
|
||||
uint64_t lprofGetLoadModuleSignature() {
|
||||
/* A very fast way to compute a module signature. */
|
||||
uint64_t Version = __llvm_profile_get_version();
|
||||
uint64_t CounterSize = (uint64_t)(__llvm_profile_end_counters() -
|
||||
__llvm_profile_begin_counters());
|
||||
uint64_t DataSize = __llvm_profile_get_data_size(__llvm_profile_begin_data(),
|
||||
@ -34,7 +33,7 @@ uint64_t lprofGetLoadModuleSignature() {
|
||||
const __llvm_profile_data *FirstD = __llvm_profile_begin_data();
|
||||
|
||||
return (NamesSize << 40) + (CounterSize << 30) + (DataSize << 20) +
|
||||
(NumVnodes << 10) + (DataSize > 0 ? FirstD->NameRef : 0) + Version;
|
||||
(NumVnodes << 10) + (DataSize > 0 ? FirstD->NameRef : 0);
|
||||
}
|
||||
|
||||
/* Returns 1 if profile is not structurally compatible. */
|
||||
@ -45,8 +44,7 @@ int __llvm_profile_check_compatibility(const char *ProfileData,
|
||||
__llvm_profile_header *Header = (__llvm_profile_header *)ProfileData;
|
||||
__llvm_profile_data *SrcDataStart, *SrcDataEnd, *SrcData, *DstData;
|
||||
SrcDataStart =
|
||||
(__llvm_profile_data *)(ProfileData + sizeof(__llvm_profile_header) +
|
||||
Header->BinaryIdsSize);
|
||||
(__llvm_profile_data *)(ProfileData + sizeof(__llvm_profile_header));
|
||||
SrcDataEnd = SrcDataStart + Header->DataSize;
|
||||
|
||||
if (ProfileSize < sizeof(__llvm_profile_header))
|
||||
@ -65,7 +63,7 @@ int __llvm_profile_check_compatibility(const char *ProfileData,
|
||||
Header->ValueKindLast != IPVK_Last)
|
||||
return 1;
|
||||
|
||||
if (ProfileSize < sizeof(__llvm_profile_header) + Header->BinaryIdsSize +
|
||||
if (ProfileSize < sizeof(__llvm_profile_header) +
|
||||
Header->DataSize * sizeof(__llvm_profile_data) +
|
||||
Header->NamesSize + Header->CountersSize)
|
||||
return 1;
|
||||
@ -102,8 +100,7 @@ int __llvm_profile_merge_from_buffer(const char *ProfileData,
|
||||
uintptr_t CountersDelta = Header->CountersDelta;
|
||||
|
||||
SrcDataStart =
|
||||
(__llvm_profile_data *)(ProfileData + sizeof(__llvm_profile_header) +
|
||||
Header->BinaryIdsSize);
|
||||
(__llvm_profile_data *)(ProfileData + sizeof(__llvm_profile_header));
|
||||
SrcDataEnd = SrcDataStart + Header->DataSize;
|
||||
SrcCountersStart = (uint64_t *)SrcDataEnd;
|
||||
SrcNameStart = (const char *)(SrcCountersStart + Header->CountersSize);
|
||||
|
@ -10,13 +10,6 @@
|
||||
// RUN: llvm-profdata show --binary-ids %t.profraw > %t.profraw.out
|
||||
// RUN: FileCheck %s --check-prefix=BINARY-ID-RAW-PROF < %t.profraw.out
|
||||
|
||||
// RUN: rm -rf %t.profdir
|
||||
// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
|
||||
// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
|
||||
// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
|
||||
// RUN: llvm-profdata show --binary-ids %t.profdir/default_*.profraw > %t.profraw.out
|
||||
// RUN: FileCheck %s --check-prefix=BINARY-ID-MERGE-PROF < %t.profraw.out
|
||||
|
||||
void foo() {
|
||||
}
|
||||
|
||||
@ -41,10 +34,3 @@ int main() {
|
||||
// BINARY-ID-RAW-PROF-NEXT: Maximum internal block count: 0
|
||||
// BINARY-ID-RAW-PROF-NEXT: Binary IDs:
|
||||
// BINARY-ID-RAW-PROF-NEXT: {{[0-9a-f]+}}
|
||||
|
||||
// BINARY-ID-MERGE-PROF: Instrumentation level: Front-end
|
||||
// BINARY-ID-MERGE-PROF-NEXT: Total functions: 3
|
||||
// BINARY-ID-MERGE-PROF-NEXT: Maximum function count: 3
|
||||
// BINARY-ID-MERGE-PROF-NEXT: Maximum internal block count: 0
|
||||
// BINARY-ID-MERGE-PROF-NEXT: Binary IDs:
|
||||
// BINARY-ID-MERGE-PROF-NEXT: {{[0-9a-f]+}}
|
||||
|
@ -127,7 +127,6 @@ INSTR_PROF_VALUE_NODE(PtrToNodeT, llvm::Type::getInt8PtrTy(Ctx), Next, \
|
||||
#endif
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, Magic, __llvm_profile_get_magic())
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, Version, __llvm_profile_get_version())
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, PaddingBytesBeforeCounters, PaddingBytesBeforeCounters)
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)
|
||||
@ -137,6 +136,7 @@ INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta,
|
||||
(uintptr_t)CountersBegin - (uintptr_t)DataBegin)
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin)
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)
|
||||
INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
|
||||
#undef INSTR_PROF_RAW_HEADER
|
||||
/* INSTR_PROF_RAW_HEADER end */
|
||||
|
||||
@ -645,7 +645,7 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
|
||||
(uint64_t)'f' << 16 | (uint64_t)'R' << 8 | (uint64_t)129
|
||||
|
||||
/* Raw profile format version (start from 1). */
|
||||
#define INSTR_PROF_RAW_VERSION 7
|
||||
#define INSTR_PROF_RAW_VERSION 6
|
||||
/* Indexed profile format version (start from 1). */
|
||||
#define INSTR_PROF_INDEX_VERSION 7
|
||||
/* Coverage mapping format version (start from 0). */
|
||||
|
@ -366,7 +366,6 @@ Error RawInstrProfReader<IntPtrT>::readHeader(
|
||||
if (GET_VERSION(Version) != RawInstrProf::Version)
|
||||
return error(instrprof_error::unsupported_version);
|
||||
|
||||
BinaryIdsSize = swap(Header.BinaryIdsSize);
|
||||
CountersDelta = swap(Header.CountersDelta);
|
||||
NamesDelta = swap(Header.NamesDelta);
|
||||
auto DataSize = swap(Header.DataSize);
|
||||
@ -375,6 +374,7 @@ Error RawInstrProfReader<IntPtrT>::readHeader(
|
||||
auto PaddingBytesAfterCounters = swap(Header.PaddingBytesAfterCounters);
|
||||
NamesSize = swap(Header.NamesSize);
|
||||
ValueKindLast = swap(Header.ValueKindLast);
|
||||
BinaryIdsSize = swap(Header.BinaryIdsSize);
|
||||
|
||||
auto DataSizeInBytes = DataSize * sizeof(RawInstrProf::ProfileData<IntPtrT>);
|
||||
auto PaddingSize = getNumPaddingBytes(NamesSize);
|
||||
|
Loading…
x
Reference in New Issue
Block a user