[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
Wed Jun 26 15:11:09 PDT 2024
================
@@ -140,14 +348,56 @@ 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 for the callsite.
+ bool isProfitableToCompareVTables(
+ const CallBase &CB, const std::vector<PromotionCandidate> &Candidates,
+ uint64_t TotalCount);
+
+ // Given an indirect callsite and the list of function candidates, compute
+ // the following vtable information in output parameters and returns vtable
+ // pointer if type profiles exist.
+ // - Populate `VTableGUIDCounts` with <vtable-guid, count> using !prof
+ // metadata attached on the vtable pointer.
+ // - For each function candidate, finds out the vtables from which it get
----------------
minglotus-6 wrote:
done.
https://github.com/llvm/llvm-project/pull/81442
More information about the cfe-commits
mailing list