[all-commits] [llvm/llvm-project] f21473: [InstrProf][NFC] Do not assume size of counter type

Ellis Hoag via All-commits all-commits at lists.llvm.org
Fri Jan 14 11:29:24 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f21473752bd6ef85a4da5d51948ce21f7226f81b
      https://github.com/llvm/llvm-project/commit/f21473752bd6ef85a4da5d51948ce21f7226f81b
  Author: Ellis Hoag <ellis.sparky.hoag at gmail.com>
  Date:   2022-01-14 (Fri, 14 Jan 2022)

  Changed paths:
    M compiler-rt/include/profile/InstrProfData.inc
    M compiler-rt/lib/profile/InstrProfiling.c
    M compiler-rt/lib/profile/InstrProfiling.h
    M compiler-rt/lib/profile/InstrProfilingBuffer.c
    M compiler-rt/lib/profile/InstrProfilingFile.c
    M compiler-rt/lib/profile/InstrProfilingInternal.h
    M compiler-rt/lib/profile/InstrProfilingMerge.c
    M compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c
    M compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c
    M compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
    M compiler-rt/lib/profile/InstrProfilingPlatformOther.c
    M compiler-rt/lib/profile/InstrProfilingPlatformWindows.c
    M compiler-rt/lib/profile/InstrProfilingWriter.c
    M compiler-rt/test/profile/instrprof-write-buffer-internal.c
    M llvm/include/llvm/ProfileData/InstrProfData.inc
    M llvm/include/llvm/ProfileData/InstrProfReader.h
    M llvm/lib/ProfileData/InstrProfReader.cpp
    M llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test

  Log Message:
  -----------
  [InstrProf][NFC] Do not assume size of counter type

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.

Change the meaning of `DataSize` and `CountersSize` to make them more clear.
* `DataSize` (`CountersSize`) - the size of the data (counter) section in bytes.
* `NumData` (`NumCounters`) - the number of data (counter) entries.

Reviewed By: kyulee

Differential Revision: https://reviews.llvm.org/D116179




More information about the All-commits mailing list