[llvm] [PassBuilder] Add extra ModuleInliner/SROA/SimplifyCFG/LICM to late FullLTO passes (PR #197678)
Momchil Velikov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 16 04:47:13 PDT 2026
================
@@ -2250,6 +2250,18 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(MainFPM),
PTO.EagerlyInvalidateAnalyses));
+ if (EnableModuleInliner) {
+ MPM.addPass(ModuleInlinerPass(::getInlineParamsFromOptLevel(Level),
+ UseInlineAdvisor,
+ ThinOrFullLTOPhase::FullLTOPostLink));
+ } else {
+ MPM.addPass(ModuleInlinerWrapperPass(
+ ::getInlineParamsFromOptLevel(Level),
+ /* MandatoryFirst */ true,
+ InlineContext{ThinOrFullLTOPhase::FullLTOPostLink,
+ InlinePass::CGSCCInliner}));
+ }
----------------
momchil-velikov wrote:
No, it is not running after the vectorisation passes when they are disabled in the pre-LTO pipeline.
A few hot functions in `femflow` contain big composites passed as arguments or returned as return values. In the current `main` pipeline pre-link SLP reduces the size of some functions, LTO inliner inlines them, and then SROA triggers, optimising several memset/memcpy calls. Without the pre-link SLP, the LTO inliner does not trigger, and then SROA does not trigger (due to `alloca` addresses escaping to non-inline callees) and then we get 9% regression.
Adding the Inliner + SROA after the LTO SLP recreates the above optimisation sequence, restoring about 8% of the regression.
https://github.com/llvm/llvm-project/pull/197678
More information about the llvm-commits
mailing list