[PATCH] D151053: [PassManager] Add extension point to LTO pipeline to enable module optimization passes to run shortly before loop optimizations
William Moses via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 21 18:48:13 PDT 2023
wsmoses updated this revision to Diff 524144.
wsmoses added a comment.
Move location of call before analysis
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151053/new/
https://reviews.llvm.org/D151053
Files:
llvm/include/llvm/Passes/PassBuilder.h
llvm/lib/Passes/PassBuilderPipelines.cpp
Index: llvm/lib/Passes/PassBuilderPipelines.cpp
===================================================================
--- llvm/lib/Passes/PassBuilderPipelines.cpp
+++ llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -340,6 +340,11 @@
for (auto &C : FullLinkTimeOptimizationEarlyEPCallbacks)
C(MPM, Level);
}
+void PassBuilder::invokeFullLinkTimeOptimizationBeforeLoopEPCallbacks(
+ ModulePassManager &MPM, OptimizationLevel Level) {
+ for (auto &C : FullLinkTimeOptimizationBeforeLoopEPCallbacks)
+ C(MPM, Level);
+}
void PassBuilder::invokeFullLinkTimeOptimizationLastEPCallbacks(
ModulePassManager &MPM, OptimizationLevel Level) {
for (auto &C : FullLinkTimeOptimizationLastEPCallbacks)
@@ -1791,9 +1796,12 @@
MPM.addPass(
createModuleToPostOrderCGSCCPassAdaptor(PostOrderFunctionAttrsPass()));
+ invokeFullLinkTimeOptimizationBeforeLoopEPCallbacks(MPM, Level);
+
// Require the GlobalsAA analysis for the module so we can query it within
// MainFPM.
MPM.addPass(RequireAnalysisPass<GlobalsAA, Module>());
+
// Invalidate AAManager so it can be recreated and pick up the newly available
// GlobalsAA.
MPM.addPass(
Index: llvm/include/llvm/Passes/PassBuilder.h
===================================================================
--- llvm/include/llvm/Passes/PassBuilder.h
+++ llvm/include/llvm/Passes/PassBuilder.h
@@ -470,6 +470,15 @@
const std::function<void(ModulePassManager &, OptimizationLevel)> &C) {
FullLinkTimeOptimizationEarlyEPCallbacks.push_back(C);
}
+
+ /// Register a callback for a default optimizer pipeline extension point
+ ///
+ /// This extension point allows adding optimizations at the module level before
+ /// any loop optimizations are run.
+ void registerFullLinkTimeOptimizatioBeforeLoopEPCallback(
+ const std::function<void(ModulePassManager &, OptimizationLevel)> &C) {
+ FullLinkTimeOptimizationBeforeLoopEPCallbacks.push_back(C);
+ }
/// Register a callback for a default optimizer pipeline extension point
///
@@ -576,6 +585,8 @@
OptimizationLevel Level);
void invokeFullLinkTimeOptimizationEarlyEPCallbacks(ModulePassManager &MPM,
OptimizationLevel Level);
+ void invokeFullLinkTimeOptimizationBeforeLoopEPCallbacks(ModulePassManager &MPM,
+ OptimizationLevel Level);
void invokeFullLinkTimeOptimizationLastEPCallbacks(ModulePassManager &MPM,
OptimizationLevel Level);
void invokePipelineStartEPCallbacks(ModulePassManager &MPM,
@@ -638,6 +649,8 @@
OptimizerLastEPCallbacks;
SmallVector<std::function<void(ModulePassManager &, OptimizationLevel)>, 2>
FullLinkTimeOptimizationEarlyEPCallbacks;
+ SmallVector<std::function<void(ModulePassManager &, OptimizationLevel)>, 2>
+ FullLinkTimeOptimizationBeforeLoopEPCallbacks;
SmallVector<std::function<void(ModulePassManager &, OptimizationLevel)>, 2>
FullLinkTimeOptimizationLastEPCallbacks;
SmallVector<std::function<void(ModulePassManager &, OptimizationLevel)>, 2>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151053.524144.patch
Type: text/x-patch
Size: 3185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230522/bd6e80af/attachment.bin>
More information about the llvm-commits
mailing list