[PATCH] D155888: [nfc] Renamed ICallPromotionFunc to InidrectCallPromoter
Mircea Trofin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 20 14:39:04 PDT 2023
mtrofin created this revision.
mtrofin added a reviewer: xur.
Herald added subscribers: Enna1, hiraditya.
Herald added a project: All.
mtrofin requested review of this revision.
Herald added subscribers: llvm-commits, wangpc.
Herald added a project: LLVM.
For (subjectively) more clarity; also updated the comment describing it.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D155888
Files:
llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
Index: llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
+++ 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::PromotionCandidate>
-ICallPromotionFunc::getPromotionCandidatesForCallSite(
+std::vector<IndirectCallPromoter::PromotionCandidate>
+IndirectCallPromoter::getPromotionCandidatesForCallSite(
const CallBase &CB, const ArrayRef<InstrProfValueData> &ValueDataRef,
uint64_t TotalCount, uint32_t NumCandidates) {
std::vector<PromotionCandidate> 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<PromotionCandidate> &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<FunctionAnalysisManagerModuleProxy>(M).getManager();
auto &ORE = FAM.getResult<OptimizationRemarkEmitterAnalysis>(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()));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155888.542678.patch
Type: text/x-patch
Size: 3058 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230720/5872c62d/attachment.bin>
More information about the llvm-commits
mailing list