[compiler-rt] 40d9561 - InstrProfilingMerge.c: Fix potential misalignment in `SrcBitmapStart`
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 17 04:10:50 PDT 2024
Author: NAKAMURA Takumi
Date: 2024-10-17T20:04:00+09:00
New Revision: 40d9561b2d5651e3d2ffa057d2b89cb8d5146fb9
URL: https://github.com/llvm/llvm-project/commit/40d9561b2d5651e3d2ffa057d2b89cb8d5146fb9
DIFF: https://github.com/llvm/llvm-project/commit/40d9561b2d5651e3d2ffa057d2b89cb8d5146fb9.diff
LOG: InstrProfilingMerge.c: Fix potential misalignment in `SrcBitmapStart`
Currently it is not an issue. It will be a problem if Bitmap is
located after single byte counters.
Added:
Modified:
compiler-rt/lib/profile/InstrProfilingMerge.c
Removed:
################################################################################
diff --git a/compiler-rt/lib/profile/InstrProfilingMerge.c b/compiler-rt/lib/profile/InstrProfilingMerge.c
index c0706b73e16687..7cf1679811eb07 100644
--- a/compiler-rt/lib/profile/InstrProfilingMerge.c
+++ b/compiler-rt/lib/profile/InstrProfilingMerge.c
@@ -154,7 +154,8 @@ int __llvm_profile_merge_from_buffer(const char *ProfileData,
SrcCountersStart = (char *)SrcDataEnd;
SrcCountersEnd = SrcCountersStart +
Header->NumCounters * __llvm_profile_counter_entry_size();
- SrcBitmapStart = SrcCountersEnd;
+ SrcBitmapStart = SrcCountersEnd + __llvm_profile_get_num_padding_bytes(
+ SrcCountersEnd - SrcCountersStart);
SrcNameStart = SrcBitmapStart + Header->NumBitmapBytes;
SrcValueProfDataStart =
SrcNameStart + getDistanceFromCounterToValueProf(Header);
More information about the llvm-commits
mailing list