diff --git a/llvm/include/llvm/Passes/PassBuilder.h b/llvm/include/llvm/Passes/PassBuilder.h --- a/llvm/include/llvm/Passes/PassBuilder.h +++ b/llvm/include/llvm/Passes/PassBuilder.h @@ -199,7 +199,7 @@ /// Construct the module pipeline that performs inlining with /// module inliner pass. - ModuleInlinerPass buildModuleInlinerPipeline(OptimizationLevel Level, + ModulePassManager buildModuleInlinerPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase); /// Construct the core LLVM module optimization pipeline. diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -754,9 +754,11 @@ return MIWP; } -ModuleInlinerPass +ModulePassManager PassBuilder::buildModuleInlinerPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase) { + ModulePassManager MPM; + InlineParams IP = getInlineParamsFromOptLevel(Level); if (Phase == ThinOrFullLTOPhase::ThinLTOPreLink && PGOOpt && PGOOpt->Action == PGOOptions::SampleUse) @@ -773,7 +775,16 @@ // inline deferral logic in module inliner. IP.EnableDeferral = false; - return ModuleInlinerPass(IP, UseInlineAdvisor); + MPM.addPass(ModuleInlinerPass(IP, UseInlineAdvisor)); + + MPM.addPass(createModuleToFunctionPassAdaptor( + buildFunctionSimplificationPipeline(Level, Phase), + PTO.EagerlyInvalidateAnalyses)); + + MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor( + CoroSplitPass(Level != OptimizationLevel::O0))); + + return MPM; } ModulePassManager