[PATCH] D151593: [MemProf] Clean up MemProf instrumentation pass invocation
Teresa Johnson via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 26 17:39:04 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf354e971b09c: [MemProf] Clean up MemProf instrumentation pass invocation (authored by tejohnson).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151593/new/
https://reviews.llvm.org/D151593
Files:
clang/lib/CodeGen/BackendUtil.cpp
llvm/lib/Passes/PassBuilderPipelines.cpp
Index: llvm/lib/Passes/PassBuilderPipelines.cpp
===================================================================
--- llvm/lib/Passes/PassBuilderPipelines.cpp
+++ llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -155,9 +155,6 @@
cl::Hidden,
cl::desc("Enable inline deferral during PGO"));
-static cl::opt<bool> EnableMemProfiler("enable-mem-prof", cl::Hidden,
- cl::desc("Enable memory profiler"));
-
static cl::opt<bool> EnableModuleInliner("enable-module-inliner",
cl::init(false), cl::Hidden,
cl::desc("Enable module inliner"));
@@ -1122,11 +1119,6 @@
MPM.addPass(GlobalOptPass());
MPM.addPass(GlobalDCEPass());
- if (EnableMemProfiler && Phase != ThinOrFullLTOPhase::ThinLTOPreLink) {
- MPM.addPass(createModuleToFunctionPassAdaptor(MemProfilerPass()));
- MPM.addPass(ModuleMemProfilerPass());
- }
-
return MPM;
}
Index: clang/lib/CodeGen/BackendUtil.cpp
===================================================================
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -992,6 +992,16 @@
MPM.addPass(InstrProfiling(*Options, false));
});
+ // TODO: Consider passing the MemoryProfileOutput to the pass builder via
+ // the PGOOptions, and set this up there.
+ if (!CodeGenOpts.MemoryProfileOutput.empty()) {
+ PB.registerOptimizerLastEPCallback(
+ [](ModulePassManager &MPM, OptimizationLevel Level) {
+ MPM.addPass(createModuleToFunctionPassAdaptor(MemProfilerPass()));
+ MPM.addPass(ModuleMemProfilerPass());
+ });
+ }
+
if (IsThinLTO) {
MPM = PB.buildThinLTOPreLinkDefaultPipeline(Level);
} else if (IsLTO) {
@@ -999,11 +1009,6 @@
} else {
MPM = PB.buildPerModuleDefaultPipeline(Level);
}
-
- if (!CodeGenOpts.MemoryProfileOutput.empty()) {
- MPM.addPass(createModuleToFunctionPassAdaptor(MemProfilerPass()));
- MPM.addPass(ModuleMemProfilerPass());
- }
}
// Add a verifier pass if requested. We don't have to do this if the action
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151593.526225.patch
Type: text/x-patch
Size: 2214 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230527/43318627/attachment.bin>
More information about the cfe-commits
mailing list