@@ -303,8 +303,6 @@ class IndirectCallPromoter {
303
303
Function &F;
304
304
Module &M;
305
305
306
- ProfileSummaryInfo *PSI = nullptr ;
307
-
308
306
// Symtab that maps indirect call profile values to function names and
309
307
// defines.
310
308
InstrProfSymtab *const Symtab;
@@ -366,8 +364,7 @@ class IndirectCallPromoter {
366
364
367
365
// Return true if it's profitable to compare vtables for the callsite.
368
366
bool isProfitableToCompareVTables (const CallBase &CB,
369
- ArrayRef<PromotionCandidate> Candidates,
370
- uint64_t TotalCount);
367
+ ArrayRef<PromotionCandidate> Candidates);
371
368
372
369
// Given an indirect callsite and the list of function candidates, compute
373
370
// the following vtable information in output parameters and return vtable
@@ -391,12 +388,11 @@ class IndirectCallPromoter {
391
388
392
389
public:
393
390
IndirectCallPromoter (
394
- Function &Func, Module &M, ProfileSummaryInfo *PSI,
395
- InstrProfSymtab *Symtab, bool SamplePGO,
391
+ Function &Func, Module &M, InstrProfSymtab *Symtab, bool SamplePGO,
396
392
const VirtualCallSiteTypeInfoMap &VirtualCSInfo,
397
393
VTableAddressPointOffsetValMap &VTableAddressPointOffsetVal,
398
394
OptimizationRemarkEmitter &ORE)
399
- : F(Func), M(M), PSI(PSI), Symtab(Symtab), SamplePGO(SamplePGO),
395
+ : F(Func), M(M), Symtab(Symtab), SamplePGO(SamplePGO),
400
396
VirtualCSInfo (VirtualCSInfo),
401
397
VTableAddressPointOffsetVal(VTableAddressPointOffsetVal), ORE(ORE) {}
402
398
IndirectCallPromoter (const IndirectCallPromoter &) = delete;
@@ -821,7 +817,7 @@ bool IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) {
821
817
Instruction *VPtr =
822
818
computeVTableInfos (CB, VTableGUIDCounts, PromotionCandidates);
823
819
824
- if (isProfitableToCompareVTables (*CB, PromotionCandidates, TotalCount ))
820
+ if (isProfitableToCompareVTables (*CB, PromotionCandidates))
825
821
Changed |= tryToPromoteWithVTableCmp (*CB, VPtr, PromotionCandidates,
826
822
TotalCount, NumCandidates,
827
823
ICallProfDataRef, VTableGUIDCounts);
@@ -836,13 +832,11 @@ bool IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) {
836
832
// TODO: Return false if the function addressing and vtable load instructions
837
833
// cannot sink to indirect fallback.
838
834
bool IndirectCallPromoter::isProfitableToCompareVTables (
839
- const CallBase &CB, ArrayRef<PromotionCandidate> Candidates,
840
- uint64_t TotalCount) {
835
+ const CallBase &CB, ArrayRef<PromotionCandidate> Candidates) {
841
836
if (!EnableVTableProfileUse || Candidates.empty ())
842
837
return false ;
843
838
LLVM_DEBUG (dbgs () << " \n Evaluating vtable profitability for callsite #"
844
839
<< NumOfPGOICallsites << CB << " \n " );
845
- uint64_t RemainingVTableCount = TotalCount;
846
840
const size_t CandidateSize = Candidates.size ();
847
841
for (size_t I = 0 ; I < CandidateSize; I++) {
848
842
auto &Candidate = Candidates[I];
@@ -868,8 +862,6 @@ bool IndirectCallPromoter::isProfitableToCompareVTables(
868
862
return false ;
869
863
}
870
864
871
- RemainingVTableCount -= Candidate.Count ;
872
-
873
865
// 'MaxNumVTable' limits the number of vtables to make vtable comparison
874
866
// profitable. Comparing multiple vtables for one function candidate will
875
867
// insert additional instructions on the hot path, and allowing more than
@@ -984,8 +976,7 @@ static bool promoteIndirectCalls(Module &M, ProfileSummaryInfo *PSI, bool InLTO,
984
976
MAM.getResult <FunctionAnalysisManagerModuleProxy>(M).getManager ();
985
977
auto &ORE = FAM.getResult <OptimizationRemarkEmitterAnalysis>(F);
986
978
987
- IndirectCallPromoter CallPromoter (F, M, PSI, &Symtab, SamplePGO,
988
- VirtualCSInfo,
979
+ IndirectCallPromoter CallPromoter (F, M, &Symtab, SamplePGO, VirtualCSInfo,
989
980
VTableAddressPointOffsetVal, ORE);
990
981
bool FuncChanged = CallPromoter.processFunction (PSI);
991
982
if (ICPDUMPAFTER && FuncChanged) {
0 commit comments