[llvm] [Analysis] Clean up getPromotionCandidatesForInstruction (NFC) (PR #95624)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 14 16:55:38 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
@llvm/pr-subscribers-llvm-analysis
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
Callers of getPromotionCandidatesForInstruction pass NumVals as an out
parameter for the number of value-count pairs of the value profiling
data, but nobody uses the out parameter.
This patch removes the parameter and updates the callers. Note that
the number of value-count pairs is still available via
getPromotionCandidatesForInstruction(...).size().
---
Full diff: https://github.com/llvm/llvm-project/pull/95624.diff
4 Files Affected:
- (modified) llvm/include/llvm/Analysis/IndirectCallPromotionAnalysis.h (+2-4)
- (modified) llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp (+2-2)
- (modified) llvm/lib/Analysis/ModuleSummaryAnalysis.cpp (+3-3)
- (modified) llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp (+2-2)
``````````diff
diff --git a/llvm/include/llvm/Analysis/IndirectCallPromotionAnalysis.h b/llvm/include/llvm/Analysis/IndirectCallPromotionAnalysis.h
index 8a05e913a9106..e0e8a7cda9369 100644
--- a/llvm/include/llvm/Analysis/IndirectCallPromotionAnalysis.h
+++ b/llvm/include/llvm/Analysis/IndirectCallPromotionAnalysis.h
@@ -57,10 +57,8 @@ class ICallPromotionAnalysis {
///
/// The returned array space is owned by this class, and overwritten on
/// subsequent calls.
- ArrayRef<InstrProfValueData>
- getPromotionCandidatesForInstruction(const Instruction *I, uint32_t &NumVals,
- uint64_t &TotalCount,
- uint32_t &NumCandidates);
+ ArrayRef<InstrProfValueData> getPromotionCandidatesForInstruction(
+ const Instruction *I, uint64_t &TotalCount, uint32_t &NumCandidates);
};
} // end namespace llvm
diff --git a/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp b/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp
index 84b0a1b2a5387..a71ab23a30902 100644
--- a/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp
+++ b/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp
@@ -89,8 +89,8 @@ uint32_t ICallPromotionAnalysis::getProfitablePromotionCandidates(
ArrayRef<InstrProfValueData>
ICallPromotionAnalysis::getPromotionCandidatesForInstruction(
- const Instruction *I, uint32_t &NumVals, uint64_t &TotalCount,
- uint32_t &NumCandidates) {
+ const Instruction *I, uint64_t &TotalCount, uint32_t &NumCandidates) {
+ uint32_t NumVals;
auto Res = getValueProfDataFromInst(*I, IPVK_IndirectCallTarget,
MaxNumPromotions, NumVals, TotalCount);
if (!Res) {
diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
index a9913773fd13e..c6934f55ee114 100644
--- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -483,11 +483,11 @@ static void computeFunctionSummary(
}
}
- uint32_t NumVals, NumCandidates;
+ uint32_t NumCandidates;
uint64_t TotalCount;
auto CandidateProfileData =
- ICallAnalysis.getPromotionCandidatesForInstruction(
- &I, NumVals, TotalCount, NumCandidates);
+ ICallAnalysis.getPromotionCandidatesForInstruction(&I, TotalCount,
+ NumCandidates);
for (const auto &Candidate : CandidateProfileData)
CallGraphEdges[Index.getOrInsertValueInfo(Candidate.Value)]
.updateHotness(getHotness(Candidate.Count, PSI));
diff --git a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
index 6db76ca78b218..bb8019b5c31d8 100644
--- a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
+++ b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
@@ -315,10 +315,10 @@ bool IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) {
bool Changed = false;
ICallPromotionAnalysis ICallAnalysis;
for (auto *CB : findIndirectCalls(F)) {
- uint32_t NumVals, NumCandidates;
+ uint32_t NumCandidates;
uint64_t TotalCount;
auto ICallProfDataRef = ICallAnalysis.getPromotionCandidatesForInstruction(
- CB, NumVals, TotalCount, NumCandidates);
+ CB, TotalCount, NumCandidates);
if (!NumCandidates ||
(PSI && PSI->hasProfileSummary() && !PSI->isHotCount(TotalCount)))
continue;
``````````
</details>
https://github.com/llvm/llvm-project/pull/95624
More information about the llvm-commits
mailing list