Skip to content

[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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions llvm/include/llvm/Analysis/IndirectCallPromotionAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading