[llvm] [NFC][PGO] Drop unused `Module` parameter in `setProfMetadata` (PR #153733)
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 14 19:22:37 PDT 2025
https://github.com/mtrofin created https://github.com/llvm/llvm-project/pull/153733
None
>From 50e8b07e15ab9a51be0c5b0a738d041a67c03bd4 Mon Sep 17 00:00:00 2001
From: Mircea Trofin <mtrofin at google.com>
Date: Thu, 14 Aug 2025 19:22:06 -0700
Subject: [PATCH] [NFC][PGO] Drop unused `Module` parameter in
`setProfMetadata`
---
.../llvm/Transforms/Instrumentation/PGOInstrumentation.h | 4 ++--
.../Transforms/Instrumentation/PGOCtxProfFlattening.cpp | 4 ++--
.../lib/Transforms/Instrumentation/PGOInstrumentation.cpp | 8 ++++----
llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)
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