Skip to content

Commit 2c2f490

Browse files
[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().
1 parent d6b0b7a commit 2c2f490

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

llvm/include/llvm/Analysis/IndirectCallPromotionAnalysis.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ class ICallPromotionAnalysis {
5757
///
5858
/// The returned array space is owned by this class, and overwritten on
5959
/// subsequent calls.
60-
ArrayRef<InstrProfValueData>
61-
getPromotionCandidatesForInstruction(const Instruction *I, uint32_t &NumVals,
62-
uint64_t &TotalCount,
63-
uint32_t &NumCandidates);
60+
ArrayRef<InstrProfValueData> getPromotionCandidatesForInstruction(
61+
const Instruction *I, uint64_t &TotalCount, uint32_t &NumCandidates);
6462
};
6563

6664
} // end namespace llvm

llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ uint32_t ICallPromotionAnalysis::getProfitablePromotionCandidates(
8989

9090
ArrayRef<InstrProfValueData>
9191
ICallPromotionAnalysis::getPromotionCandidatesForInstruction(
92-
const Instruction *I, uint32_t &NumVals, uint64_t &TotalCount,
93-
uint32_t &NumCandidates) {
92+
const Instruction *I, uint64_t &TotalCount, uint32_t &NumCandidates) {
93+
uint32_t NumVals;
9494
auto Res = getValueProfDataFromInst(*I, IPVK_IndirectCallTarget,
9595
MaxNumPromotions, NumVals, TotalCount);
9696
if (!Res) {

llvm/lib/Analysis/ModuleSummaryAnalysis.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,11 @@ static void computeFunctionSummary(
483483
}
484484
}
485485

486-
uint32_t NumVals, NumCandidates;
486+
uint32_t NumCandidates;
487487
uint64_t TotalCount;
488488
auto CandidateProfileData =
489-
ICallAnalysis.getPromotionCandidatesForInstruction(
490-
&I, NumVals, TotalCount, NumCandidates);
489+
ICallAnalysis.getPromotionCandidatesForInstruction(&I, TotalCount,
490+
NumCandidates);
491491
for (const auto &Candidate : CandidateProfileData)
492492
CallGraphEdges[Index.getOrInsertValueInfo(Candidate.Value)]
493493
.updateHotness(getHotness(Candidate.Count, PSI));

llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,10 @@ bool IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) {
315315
bool Changed = false;
316316
ICallPromotionAnalysis ICallAnalysis;
317317
for (auto *CB : findIndirectCalls(F)) {
318-
uint32_t NumVals, NumCandidates;
318+
uint32_t NumCandidates;
319319
uint64_t TotalCount;
320320
auto ICallProfDataRef = ICallAnalysis.getPromotionCandidatesForInstruction(
321-
CB, NumVals, TotalCount, NumCandidates);
321+
CB, TotalCount, NumCandidates);
322322
if (!NumCandidates ||
323323
(PSI && PSI->hasProfileSummary() && !PSI->isHotCount(TotalCount)))
324324
continue;

0 commit comments

Comments
 (0)