Skip to content

Commit 36541d9

Browse files
restore __llvm_profile_get_num_vtable, and swap the order of two header fields in raw profile header
1 parent 4786174 commit 36541d9

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

compiler-rt/include/profile/InstrProfData.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta,
166166
INSTR_PROF_RAW_HEADER(uint64_t, BitmapDelta,
167167
(uintptr_t)BitmapBegin - (uintptr_t)DataBegin)
168168
INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin)
169-
INSTR_PROF_RAW_HEADER(uint64_t, VNamesSize, VNamesSize)
170169
INSTR_PROF_RAW_HEADER(uint64_t, NumVTables, NumVTables)
170+
INSTR_PROF_RAW_HEADER(uint64_t, VNamesSize, VNamesSize)
171171
INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)
172172
#undef INSTR_PROF_RAW_HEADER
173173
/* INSTR_PROF_RAW_HEADER end */

compiler-rt/lib/profile/InstrProfilingBuffer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ uint64_t __llvm_profile_get_data_size(const __llvm_profile_data *Begin,
9393
COMPILER_RT_VISIBILITY
9494
uint64_t __llvm_profile_get_num_vtable(const VTableProfData *Begin,
9595
const VTableProfData *End) {
96-
return End - Begin;
96+
// Convert pointers to intptr_t to use integer arithmetic.
97+
intptr_t EndI = (intptr_t)End, BeginI = (intptr_t)Begin;
98+
return (EndI - BeginI) / sizeof(VTableProfData);
9799
}
98100

99101
COMPILER_RT_VISIBILITY

llvm/include/llvm/ProfileData/InstrProfData.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta,
166166
INSTR_PROF_RAW_HEADER(uint64_t, BitmapDelta,
167167
(uintptr_t)BitmapBegin - (uintptr_t)DataBegin)
168168
INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin)
169-
INSTR_PROF_RAW_HEADER(uint64_t, VNamesSize, VNamesSize)
170169
INSTR_PROF_RAW_HEADER(uint64_t, NumVTables, NumVTables)
170+
INSTR_PROF_RAW_HEADER(uint64_t, VNamesSize, VNamesSize)
171171
INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)
172172
#undef INSTR_PROF_RAW_HEADER
173173
/* INSTR_PROF_RAW_HEADER end */

0 commit comments

Comments
 (0)