@@ -303,8 +303,6 @@ class IndirectCallPromoter {
303303 Function &F;
304304 Module &M;
305305
306- ProfileSummaryInfo *PSI = nullptr ;
307-
308306 // Symtab that maps indirect call profile values to function names and
309307 // defines.
310308 InstrProfSymtab *const Symtab;
@@ -366,8 +364,7 @@ class IndirectCallPromoter {
366364
367365 // Return true if it's profitable to compare vtables for the callsite.
368366 bool isProfitableToCompareVTables (const CallBase &CB,
369- ArrayRef<PromotionCandidate> Candidates,
370- uint64_t TotalCount);
367+ ArrayRef<PromotionCandidate> Candidates);
371368
372369 // Given an indirect callsite and the list of function candidates, compute
373370 // the following vtable information in output parameters and return vtable
@@ -391,12 +388,11 @@ class IndirectCallPromoter {
391388
392389public:
393390 IndirectCallPromoter (
394- Function &Func, Module &M, ProfileSummaryInfo *PSI,
395- InstrProfSymtab *Symtab, bool SamplePGO,
391+ Function &Func, Module &M, InstrProfSymtab *Symtab, bool SamplePGO,
396392 const VirtualCallSiteTypeInfoMap &VirtualCSInfo,
397393 VTableAddressPointOffsetValMap &VTableAddressPointOffsetVal,
398394 OptimizationRemarkEmitter &ORE)
399- : F(Func), M(M), PSI(PSI), Symtab(Symtab), SamplePGO(SamplePGO),
395+ : F(Func), M(M), Symtab(Symtab), SamplePGO(SamplePGO),
400396 VirtualCSInfo (VirtualCSInfo),
401397 VTableAddressPointOffsetVal(VTableAddressPointOffsetVal), ORE(ORE) {}
402398 IndirectCallPromoter (const IndirectCallPromoter &) = delete;
@@ -821,7 +817,7 @@ bool IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) {
821817 Instruction *VPtr =
822818 computeVTableInfos (CB, VTableGUIDCounts, PromotionCandidates);
823819
824- if (isProfitableToCompareVTables (*CB, PromotionCandidates, TotalCount ))
820+ if (isProfitableToCompareVTables (*CB, PromotionCandidates))
825821 Changed |= tryToPromoteWithVTableCmp (*CB, VPtr, PromotionCandidates,
826822 TotalCount, NumCandidates,
827823 ICallProfDataRef, VTableGUIDCounts);
@@ -836,13 +832,11 @@ bool IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) {
836832// TODO: Return false if the function addressing and vtable load instructions
837833// cannot sink to indirect fallback.
838834bool IndirectCallPromoter::isProfitableToCompareVTables (
839- const CallBase &CB, ArrayRef<PromotionCandidate> Candidates,
840- uint64_t TotalCount) {
835+ const CallBase &CB, ArrayRef<PromotionCandidate> Candidates) {
841836 if (!EnableVTableProfileUse || Candidates.empty ())
842837 return false ;
843838 LLVM_DEBUG (dbgs () << " \n Evaluating vtable profitability for callsite #"
844839 << NumOfPGOICallsites << CB << " \n " );
845- uint64_t RemainingVTableCount = TotalCount;
846840 const size_t CandidateSize = Candidates.size ();
847841 for (size_t I = 0 ; I < CandidateSize; I++) {
848842 auto &Candidate = Candidates[I];
@@ -868,8 +862,6 @@ bool IndirectCallPromoter::isProfitableToCompareVTables(
868862 return false ;
869863 }
870864
871- RemainingVTableCount -= Candidate.Count ;
872-
873865 // 'MaxNumVTable' limits the number of vtables to make vtable comparison
874866 // profitable. Comparing multiple vtables for one function candidate will
875867 // insert additional instructions on the hot path, and allowing more than
@@ -984,8 +976,7 @@ static bool promoteIndirectCalls(Module &M, ProfileSummaryInfo *PSI, bool InLTO,
984976 MAM.getResult <FunctionAnalysisManagerModuleProxy>(M).getManager ();
985977 auto &ORE = FAM.getResult <OptimizationRemarkEmitterAnalysis>(F);
986978
987- IndirectCallPromoter CallPromoter (F, M, PSI, &Symtab, SamplePGO,
988- VirtualCSInfo,
979+ IndirectCallPromoter CallPromoter (F, M, &Symtab, SamplePGO, VirtualCSInfo,
989980 VTableAddressPointOffsetVal, ORE);
990981 bool FuncChanged = CallPromoter.processFunction (PSI);
991982 if (ICPDUMPAFTER && FuncChanged) {
0 commit comments