[compiler-rt] [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 llvm-commits llvm-commits at lists.llvm.org
Mon Oct 30 12:48:44 PDT 2023


minglotus-6 wrote:

rebase the change on a fresh commit (on Oct 27) and force push one new commit with the changes listed below.
- Set option '-enable-vtable-value-profiling' to false. This option should make this change no-op.
- For indexed profile format, store vtable names in one section by compressing them and storing blobs strings.
   - Before this commit, they are stored as OnDiskIterableHashTable but hash table is not necessary; vtable names are stored in indexed format profiles for llvm-profdata usage. Function profiles are on-disk hash table so compiler could look up profiles faster. Clean up lookuptrait and writer trait as a result.
   - In index profile reader, track {VTableNamePtr, CompressedVTableNameLen} as metadata so llvm-profdata could construct symtab by decompressing vtable names. Meanwhile, when compiler reads indexed profiles, no need to decompress vtables since symtab could be constructed from module IR.
- Use the PGOName of vtables when computing compressed strings and MD5 hash in instrumentation stage.
   - Previously, the vtable name is used. The PGOName and name of vtables are the same for global symbols. For local symbols, PGOName has the format 'filename:varname'
- In IndirectCallVisitor.h, use a heuristc to find address feeding instructions. Currently clang doesn't emit type intrinsics without '-fwhole-program-vtables'. '-fwhole-program-vtables' requires '-flto', and '-flto' might not be enabled at instrumentation phase.
- In ValueProfilePlugins.inc, skip landingpad and catchpad instructions (to keep them the first non-phi) when finding an insertion point for value profile intrinsic.
- In InstrProf.cpp, simplify string decompression code by adding helper functions.
- In llvm-profdata.cpp, print the number of instrumented vtable sites and vpstats.


https://github.com/llvm/llvm-project/pull/66825


More information about the llvm-commits mailing list