-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[NFC][PGO] Drop unused Module parameter in setProfMetadata
#153733
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
mtrofin
merged 1 commit into
main
from
users/mtrofin/08-14-_nfc_pgo_drop_unused_module_parameter_in_setprofmetadata_
Aug 15, 2025
Merged
[NFC][PGO] Drop unused Module parameter in setProfMetadata
#153733
mtrofin
merged 1 commit into
main
from
users/mtrofin/08-14-_nfc_pgo_drop_unused_module_parameter_in_setprofmetadata_
Aug 15, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
|
@llvm/pr-subscribers-pgo @llvm/pr-subscribers-llvm-transforms Author: Mircea Trofin (mtrofin) ChangesFull diff: https://github.com/llvm/llvm-project/pull/153733.diff 4 Files Affected:
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");
|
Member
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

No description provided.