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

Mingming Liu via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 6 23:15:42 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
----------------
minglotus-6 wrote:

I updated the function comment.

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


More information about the cfe-commits mailing list