[llvm] [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
Fri Sep 29 15:11:13 PDT 2023


================
@@ -487,20 +487,15 @@ Error InstrProfSymtab::addFuncWithName(Function &F, StringRef PGOFuncName) {
 
 uint64_t InstrProfSymtab::getVTableHashFromAddress(uint64_t Address) {
   finalizeSymtab();
-  // printf("look up key 0x%llx\n", Address);
-  // for (auto iter = VTableAddrToMD5Map.begin(); iter !=
-  // VTableAddrToMD5Map.end(); iter++) {
-  //   printf("<key, val> is <0x%llx, %"PRIu64"\n", iter->first, iter->second);
-  // }
   auto It =
       partition_point(VTableAddrToMD5Map, [=](std::pair<uint64_t, uint64_t> A) {
         return A.first < Address;
       });
----------------
minglotus-6 wrote:

I'll change this to use both beginning and ending address of the vtable to ensure the address is in the middle (not just smaller than the end), in case some instrumented addresses are from c++ virtual table objects that doesn't generate a VTableProfData (e.g. the virtual table object is in module foo that doesn't enable type metadata on variables , address capture in module bar that generate the address).

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


More information about the llvm-commits mailing list