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

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 14:31:31 PDT 2024


================
@@ -140,14 +337,51 @@ class IndirectCallPromoter {
   // indirect callee with functions. Returns true if there are IR
   // transformations and false otherwise.
   bool tryToPromoteWithFuncCmp(
-      CallBase &CB, const std::vector<PromotionCandidate> &Candidates,
-      uint64_t TotalCount, ArrayRef<InstrProfValueData> ICallProfDataRef,
-      uint32_t NumCandidates);
+      CallBase &CB, Instruction *VPtr,
+      const std::vector<PromotionCandidate> &Candidates, uint64_t TotalCount,
+      ArrayRef<InstrProfValueData> ICallProfDataRef, uint32_t NumCandidates,
+      VTableGUIDCountsMap &VTableGUIDCounts);
+
+  // Promote a list of targets for one indirect call by comparing vtables with
+  // functions. Returns true if there are IR transformations and false
+  // otherwise.
+  bool tryToPromoteWithVTableCmp(
+      CallBase &CB, Instruction *VPtr,
+      const std::vector<PromotionCandidate> &Candidates,
+      uint64_t TotalFuncCount, uint32_t NumCandidates,
+      MutableArrayRef<InstrProfValueData> ICallProfDataRef,
+      VTableGUIDCountsMap &VTableGUIDCounts);
+
+  // Returns true if it's profitable to compare vtables.
+  bool isProfitableToCompareVTables(
+      const std::vector<PromotionCandidate> &Candidates, uint64_t TotalCount);
+
+  // Populate `VTableGUIDCounts` vtable GUIDs and their counts and each
----------------
teresajohnson wrote:

should that be "for each candidate with vtable information"?

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


More information about the llvm-commits mailing list