[PATCH] D116179: [InstrProf][NFC] Do not assume size of counter type
Ellis Hoag via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 22 11:31:00 PST 2021
ellis created this revision.
Herald added subscribers: abrachet, hiraditya.
ellis added reviewers: kyulee, MaskRay.
ellis published this revision for review.
Herald added projects: Sanitizers, LLVM.
Herald added subscribers: llvm-commits, Sanitizers.
Existing code tended to assume that counters had type `uint64_t` and
computed size from the number of counters. Fix this code to directly
compute the counters size in number of bytes where possible. When the
number of counters is needed, use `__llvm_profile_counter_entry_size()`
or `getCounterTypeSize()`. In a later diff these functions will depend
on the profile mode.
The InstrProf header field `CountersSize` has an unfortunate name
because it is really storing the number of counters rather than the size
of the counters in bytes.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D116179
Files:
compiler-rt/lib/profile/InstrProfiling.c
compiler-rt/lib/profile/InstrProfiling.h
compiler-rt/lib/profile/InstrProfilingBuffer.c
compiler-rt/lib/profile/InstrProfilingFile.c
compiler-rt/lib/profile/InstrProfilingInternal.h
compiler-rt/lib/profile/InstrProfilingMerge.c
compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c
compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
compiler-rt/lib/profile/InstrProfilingPlatformOther.c
compiler-rt/lib/profile/InstrProfilingPlatformWindows.c
compiler-rt/lib/profile/InstrProfilingWriter.c
compiler-rt/test/profile/instrprof-write-buffer-internal.c
llvm/include/llvm/ProfileData/InstrProfReader.h
llvm/lib/ProfileData/InstrProfReader.cpp
llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116179.395909.patch
Type: text/x-patch
Size: 36436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211222/543be029/attachment-0001.bin>
More information about the llvm-commits
mailing list