diff --git a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp --- a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp +++ b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp @@ -104,9 +104,9 @@ namespace { -// The class for main data structure to promote indirect calls to conditional -// direct calls. -class ICallPromotionFunc { +// Promote indirect calls to conditional direct calls, keeping track of +// thresholds. +class IndirectCallPromoter { private: Function &F; @@ -142,11 +142,11 @@ uint64_t &TotalCount); public: - ICallPromotionFunc(Function &Func, InstrProfSymtab *Symtab, bool SamplePGO, - OptimizationRemarkEmitter &ORE) + IndirectCallPromoter(Function &Func, InstrProfSymtab *Symtab, bool SamplePGO, + OptimizationRemarkEmitter &ORE) : F(Func), Symtab(Symtab), SamplePGO(SamplePGO), ORE(ORE) {} - ICallPromotionFunc(const ICallPromotionFunc &) = delete; - ICallPromotionFunc &operator=(const ICallPromotionFunc &) = delete; + IndirectCallPromoter(const IndirectCallPromoter &) = delete; + IndirectCallPromoter &operator=(const IndirectCallPromoter &) = delete; bool processFunction(ProfileSummaryInfo *PSI); }; @@ -155,8 +155,8 @@ // Indirect-call promotion heuristic. The direct targets are sorted based on // the count. Stop at the first target that is not promoted. -std::vector -ICallPromotionFunc::getPromotionCandidatesForCallSite( +std::vector +IndirectCallPromoter::getPromotionCandidatesForCallSite( const CallBase &CB, const ArrayRef &ValueDataRef, uint64_t TotalCount, uint32_t NumCandidates) { std::vector Ret; @@ -275,7 +275,7 @@ } // Promote indirect-call to conditional direct-call for one callsite. -uint32_t ICallPromotionFunc::tryToPromote( +uint32_t IndirectCallPromoter::tryToPromote( CallBase &CB, const std::vector &Candidates, uint64_t &TotalCount) { uint32_t NumPromoted = 0; @@ -294,7 +294,7 @@ // Traverse all the indirect-call callsite and get the value profile // annotation to perform indirect-call promotion. -bool ICallPromotionFunc::processFunction(ProfileSummaryInfo *PSI) { +bool IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) { bool Changed = false; ICallPromotionAnalysis ICallAnalysis; for (auto *CB : findIndirectCalls(F)) { @@ -344,7 +344,7 @@ MAM.getResult(M).getManager(); auto &ORE = FAM.getResult(F); - ICallPromotionFunc ICallPromotion(F, &Symtab, SamplePGO, ORE); + IndirectCallPromoter ICallPromotion(F, &Symtab, SamplePGO, ORE); bool FuncChanged = ICallPromotion.processFunction(PSI); if (ICPDUMPAFTER && FuncChanged) { LLVM_DEBUG(dbgs() << "\n== IR Dump After =="; F.print(dbgs()));