Skip to content

Commit 50c876a

Browse files
authored
[nfc][ctx_prof] Remove the need for PassBuilder to know about UseCtxProfile (#104492)
1 parent 062ae04 commit 50c876a

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

llvm/include/llvm/Analysis/CtxProfAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class CtxProfAnalysis : public AnalysisInfoMixin<CtxProfAnalysis> {
7979

8080
public:
8181
static AnalysisKey Key;
82-
explicit CtxProfAnalysis(StringRef Profile) : Profile(Profile) {};
82+
explicit CtxProfAnalysis(StringRef Profile = "");
8383

8484
using Result = PGOContextualProfile;
8585

llvm/lib/Analysis/CtxProfAnalysis.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ GlobalValue::GUID AssignGUIDPass::getGUID(const Function &F) {
9696
}
9797
AnalysisKey CtxProfAnalysis::Key;
9898

99+
CtxProfAnalysis::CtxProfAnalysis(StringRef Profile)
100+
: Profile(Profile.empty() ? UseCtxProfile : Profile) {}
101+
99102
PGOContextualProfile CtxProfAnalysis::run(Module &M,
100103
ModuleAnalysisManager &MAM) {
101104
ErrorOr<std::unique_ptr<MemoryBuffer>> MB = MemoryBuffer::getFile(Profile);

llvm/lib/Passes/PassBuilder.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,6 @@ cl::opt<bool> PrintPipelinePasses(
334334
"(best-effort only)."));
335335
} // namespace llvm
336336

337-
extern cl::opt<std::string> UseCtxProfile;
338-
339337
AnalysisKey NoOpModuleAnalysis::Key;
340338
AnalysisKey NoOpCGSCCAnalysis::Key;
341339
AnalysisKey NoOpFunctionAnalysis::Key;

llvm/lib/Passes/PassRegistry.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#endif
2121
MODULE_ANALYSIS("callgraph", CallGraphAnalysis())
2222
MODULE_ANALYSIS("collector-metadata", CollectorMetadataAnalysis())
23-
MODULE_ANALYSIS("ctx-prof-analysis", CtxProfAnalysis(UseCtxProfile))
23+
MODULE_ANALYSIS("ctx-prof-analysis", CtxProfAnalysis())
2424
MODULE_ANALYSIS("dxil-metadata", DXILMetadataAnalysis())
2525
MODULE_ANALYSIS("dxil-resource", DXILResourceAnalysis())
2626
MODULE_ANALYSIS("inline-advisor", InlineAdvisorAnalysis())

0 commit comments

Comments
 (0)