[llvm] Fix unused variable error (PR #106279)
Mingming Liu via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 27 12:56:07 PDT 2024
https://github.com/minglotus-6 updated https://github.com/llvm/llvm-project/pull/106279
>From 04fed776504f88df69bc9c44d9079d0c6396b6bc Mon Sep 17 00:00:00 2001
From: mingmingl <mingmingl at google.com>
Date: Tue, 27 Aug 2024 12:52:31 -0700
Subject: [PATCH] Fix unused variable error
---
.../Instrumentation/IndirectCallPromotion.cpp | 21 +++----------------
1 file changed, 3 insertions(+), 18 deletions(-)
diff --git a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
index 0d1f506986379d..e9b6c3090d867c 100644
--- a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
+++ b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
@@ -303,8 +303,6 @@ class IndirectCallPromoter {
Function &F;
Module &M;
- ProfileSummaryInfo *PSI = nullptr;
-
// Symtab that maps indirect call profile values to function names and
// defines.
InstrProfSymtab *const Symtab;
@@ -391,12 +389,11 @@ class IndirectCallPromoter {
public:
IndirectCallPromoter(
- Function &Func, Module &M, ProfileSummaryInfo *PSI,
- InstrProfSymtab *Symtab, bool SamplePGO,
+ Function &Func, Module &M, InstrProfSymtab *Symtab, bool SamplePGO,
const VirtualCallSiteTypeInfoMap &VirtualCSInfo,
VTableAddressPointOffsetValMap &VTableAddressPointOffsetVal,
OptimizationRemarkEmitter &ORE)
- : F(Func), M(M), PSI(PSI), Symtab(Symtab), SamplePGO(SamplePGO),
+ : F(Func), M(M), Symtab(Symtab), SamplePGO(SamplePGO),
VirtualCSInfo(VirtualCSInfo),
VTableAddressPointOffsetVal(VTableAddressPointOffsetVal), ORE(ORE) {}
IndirectCallPromoter(const IndirectCallPromoter &) = delete;
@@ -842,7 +839,6 @@ bool IndirectCallPromoter::isProfitableToCompareVTables(
return false;
LLVM_DEBUG(dbgs() << "\nEvaluating vtable profitability for callsite #"
<< NumOfPGOICallsites << CB << "\n");
- uint64_t RemainingVTableCount = TotalCount;
const size_t CandidateSize = Candidates.size();
for (size_t I = 0; I < CandidateSize; I++) {
auto &Candidate = Candidates[I];
@@ -868,8 +864,6 @@ bool IndirectCallPromoter::isProfitableToCompareVTables(
return false;
}
- RemainingVTableCount -= Candidate.Count;
-
// 'MaxNumVTable' limits the number of vtables to make vtable comparison
// profitable. Comparing multiple vtables for one function candidate will
// insert additional instructions on the hot path, and allowing more than
@@ -888,14 +882,6 @@ bool IndirectCallPromoter::isProfitableToCompareVTables(
}
}
- // If the indirect fallback is not cold, don't compare vtables.
- if (PSI && PSI->hasProfileSummary() &&
- !PSI->isColdCount(RemainingVTableCount)) {
- LLVM_DEBUG(dbgs() << " Indirect fallback basic block is not cold. Bail "
- "out for vtable comparison.\n");
- return false;
- }
-
return true;
}
@@ -992,8 +978,7 @@ static bool promoteIndirectCalls(Module &M, ProfileSummaryInfo *PSI, bool InLTO,
MAM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
auto &ORE = FAM.getResult<OptimizationRemarkEmitterAnalysis>(F);
- IndirectCallPromoter CallPromoter(F, M, PSI, &Symtab, SamplePGO,
- VirtualCSInfo,
+ IndirectCallPromoter CallPromoter(F, M, &Symtab, SamplePGO, VirtualCSInfo,
VTableAddressPointOffsetVal, ORE);
bool FuncChanged = CallPromoter.processFunction(PSI);
if (ICPDUMPAFTER && FuncChanged) {
More information about the llvm-commits
mailing list