[llvm] 93d24b6 - [NFC][PGO] Drop unused `Module` parameter in `setProfMetadata` (#153733)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 14 19:55:43 PDT 2025
Author: Mircea Trofin
Date: 2025-08-14T19:55:39-07:00
New Revision: 93d24b6b7b148c47a2fa228a4ef31524fa1d9f3f
URL: https://github.com/llvm/llvm-project/commit/93d24b6b7b148c47a2fa228a4ef31524fa1d9f3f
DIFF: https://github.com/llvm/llvm-project/commit/93d24b6b7b148c47a2fa228a4ef31524fa1d9f3f.diff
LOG: [NFC][PGO] Drop unused `Module` parameter in `setProfMetadata` (#153733)
Added:
Modified:
llvm/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h
llvm/lib/Transforms/Instrumentation/PGOCtxProfFlattening.cpp
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h b/llvm/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h
index 5084e53b24397..ced446dacb6cc 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h
@@ -104,8 +104,8 @@ class PGOMemOPSizeOpt : public PassInfoMixin<PGOMemOPSizeOpt> {
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &MAM);
};
-LLVM_ABI void setProfMetadata(Module *M, Instruction *TI,
- ArrayRef<uint64_t> EdgeCounts, uint64_t MaxCount);
+LLVM_ABI void setProfMetadata(Instruction *TI, ArrayRef<uint64_t> EdgeCounts,
+ uint64_t MaxCount);
LLVM_ABI void setIrrLoopHeaderMetadata(Module *M, Instruction *TI,
uint64_t Count);
diff --git a/llvm/lib/Transforms/Instrumentation/PGOCtxProfFlattening.cpp b/llvm/lib/Transforms/Instrumentation/PGOCtxProfFlattening.cpp
index 61285810cc529..f5b668678ab7c 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOCtxProfFlattening.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOCtxProfFlattening.cpp
@@ -58,7 +58,7 @@ void assignProfileData(Function &F, ArrayRef<uint64_t> RawCounters) {
uint64_t TrueCount, FalseCount = 0;
if (!PA.getSelectInstrProfile(*SI, TrueCount, FalseCount))
continue;
- setProfMetadata(F.getParent(), SI, {TrueCount, FalseCount},
+ setProfMetadata(SI, {TrueCount, FalseCount},
std::max(TrueCount, FalseCount));
}
if (succ_size(&BB) < 2)
@@ -67,7 +67,7 @@ void assignProfileData(Function &F, ArrayRef<uint64_t> RawCounters) {
if (!PA.getOutgoingBranchWeights(BB, ProfileHolder, MaxCount))
continue;
assert(MaxCount > 0);
- setProfMetadata(F.getParent(), BB.getTerminator(), ProfileHolder, MaxCount);
+ setProfMetadata(BB.getTerminator(), ProfileHolder, MaxCount);
}
}
diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index 6f06a260e238c..e0b22ef94d064 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -1727,7 +1727,7 @@ void PGOUseFunc::setBranchWeights() {
}
if (MaxCount)
- setProfMetadata(M, TI, EdgeCounts, MaxCount);
+ setProfMetadata(TI, EdgeCounts, MaxCount);
else {
// A zero MaxCount can come about when we have a BB with a positive
// count, and whose successor blocks all have 0 count. This can happen
@@ -1801,7 +1801,7 @@ void SelectInstVisitor::annotateOneSelectInst(SelectInst &SI) {
SCounts[1] = (TotalCount > SCounts[0] ? TotalCount - SCounts[0] : 0);
uint64_t MaxCount = std::max(SCounts[0], SCounts[1]);
if (MaxCount)
- setProfMetadata(F.getParent(), &SI, SCounts, MaxCount);
+ setProfMetadata(&SI, SCounts, MaxCount);
}
void SelectInstVisitor::visitSelectInst(SelectInst &SI) {
@@ -2407,8 +2407,8 @@ static std::string getSimpleNodeName(const BasicBlock *Node) {
return SimpleNodeName;
}
-void llvm::setProfMetadata(Module *M, Instruction *TI,
- ArrayRef<uint64_t> EdgeCounts, uint64_t MaxCount) {
+void llvm::setProfMetadata(Instruction *TI, ArrayRef<uint64_t> EdgeCounts,
+ uint64_t MaxCount) {
assert(MaxCount > 0 && "Bad max count");
uint64_t Scale = calculateCountScale(MaxCount);
SmallVector<unsigned, 4> Weights;
diff --git a/llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp b/llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp
index ce1d9f1923d05..343bec37018c5 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp
@@ -432,7 +432,7 @@ bool MemOPSizeOpt::perform(MemOp MO) {
Updates.clear();
if (MaxCount)
- setProfMetadata(Func.getParent(), SI, CaseCounts, MaxCount);
+ setProfMetadata(SI, CaseCounts, MaxCount);
LLVM_DEBUG(dbgs() << *BB << "\n");
LLVM_DEBUG(dbgs() << *DefaultBB << "\n");
More information about the llvm-commits
mailing list