[llvm] 2c2f490 - [Analysis] Clean up getPromotionCandidatesForInstruction (NFC) (#95624)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 17 18:51:47 PDT 2024
Author: Kazu Hirata
Date: 2024-06-17T18:51:45-07:00
New Revision: 2c2f49059ff2999e06eb5ecb76af5b1ebd3e5477
URL: https://github.com/llvm/llvm-project/commit/2c2f49059ff2999e06eb5ecb76af5b1ebd3e5477
DIFF: https://github.com/llvm/llvm-project/commit/2c2f49059ff2999e06eb5ecb76af5b1ebd3e5477.diff
LOG: [Analysis] Clean up getPromotionCandidatesForInstruction (NFC) (#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().
Added:
Modified:
llvm/include/llvm/Analysis/IndirectCallPromotionAnalysis.h
llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp
llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
Removed:
################################################################################
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;
More information about the llvm-commits
mailing list