[compiler-rt] [llvm] [clang-tools-extra] [clang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do virtual table address comparision for indirect-call-promotion. (PR #66825)
Mingming Liu via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 15 14:46:10 PST 2023
================
@@ -275,18 +282,28 @@ lprofWriteDataImpl(ProfDataWriter *Writer, const __llvm_profile_data *DataBegin,
const uint64_t NumBitmapBytes =
__llvm_profile_get_num_bitmap_bytes(BitmapBegin, BitmapEnd);
const uint64_t NamesSize = __llvm_profile_get_name_size(NamesBegin, NamesEnd);
+ const uint64_t NumVTables =
+ __llvm_profile_get_num_vtable(VTableBegin, VTableEnd);
+ const uint64_t VTableSectionSize =
+ __llvm_profile_get_vtable_section_size(VTableBegin, VTableEnd);
+ // Value profiling is not supported when DebugInfoCorrelate is true.
----------------
minglotus-6 wrote:
This comment is likely cause more confusion than clearing them. I deleted it.
In the initial commit, the code and comment are like this
```
// Note, in reality, vtable profiling is not supported when DebugInfoCorrelate
// is true.
const uint64_t VNamesSize = DebugInfoCorrelate ? 0 : VNamesEnd - VNamesBegin;
```
By then, the comment explains the reason (i.e., value profiling won't happen in the first place when `DebugInfoCorrelate` is true according to [this comment](https://github.com/llvm/llvm-project/blob/72552fc5cbc0cf2f44508948a075d14f0d5aa2b3/compiler-rt/lib/profile/InstrProfilingWriter.c#L334-L335)) to set `VNamesSize` to `0` when `DebugInfoCorrelate` is true.
Now [__llvm_profile_get_name_size](https://github.com/llvm/llvm-project/blob/72552fc5cbc0cf2f44508948a075d14f0d5aa2b3/compiler-rt/lib/profile/InstrProfilingBuffer.c#L100-L104) handles the conditional zero so deleted the comment.
https://github.com/llvm/llvm-project/pull/66825
More information about the cfe-commits
mailing list