-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Analysis] Clean up getPromotionCandidatesForInstruction (NFC) #95624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Analysis] Clean up getPromotionCandidatesForInstruction (NFC) #95624
Conversation
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().
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-llvm-analysis Author: Kazu Hirata (kazutakahirata) ChangesCallers of getPromotionCandidatesForInstruction pass NumVals as an out This patch removes the parameter and updates the callers. Note that Full diff: https://github.com/llvm/llvm-project/pull/95624.diff 4 Files Affected:
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;
|
Updates the description for getPromotionCandidatesForInstruction to reflect the cleanup done in llvm#95624.
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().