[clang] [compiler-rt] [llvm] [TypeProf][InstrFDO]Implement more efficient comparison sequence for indirect-call-promotion with vtable profiles. (PR #81442)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 23:15:44 PDT 2024


================
@@ -240,27 +474,102 @@ IndirectCallPromoter::getPromotionCandidatesForCallSite(
     Ret.push_back(PromotionCandidate(TargetFunction, Count));
     TotalCount -= Count;
   }
+
   return Ret;
 }
 
+Constant *IndirectCallPromoter::getOrCreateVTableAddressPointVar(
+    GlobalVariable *GV, uint64_t AddressPointOffset) {
+  auto [Iter, Inserted] =
+      VTableAddressPointOffsetVal[GV].try_emplace(AddressPointOffset, nullptr);
+  if (Inserted)
+    Iter->second = getVTableAddressPointOffset(GV, AddressPointOffset);
+  return Iter->second;
+}
+
+Instruction *IndirectCallPromoter::computeVTableInfos(
----------------
minglotus-6 wrote:

Document output parameters and return value around class method declaration, and added more comments in the function (e.g., one example with detailed steps) as suggested.

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


More information about the llvm-commits mailing list