From: ibricchi Date: Mon, 3 Apr 2023 12:13:46 +0000 (+0200) Subject: [Pass Builder] Allow Module Inliner for full LTO X-Git-Tag: upstream/17.0.6~12877 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1a36eaa552f14e7376b38cf5fc54afdf52cc8f13;p=platform%2Fupstream%2Fllvm.git [Pass Builder] Allow Module Inliner for full LTO Currently there is no way to enable the module inliner when linking with full lto. This patch enables that option. Differential Revision: https://reviews.llvm.org/D146805 --- diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp index aaabe23..ed085b4 100644 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp @@ -1708,11 +1708,17 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level, // valuable as the inliner doesn't currently care whether it is inlining an // invoke or a call. // Run the inliner now. - MPM.addPass(ModuleInlinerWrapperPass( - getInlineParamsFromOptLevel(Level), - /* MandatoryFirst */ true, - InlineContext{ThinOrFullLTOPhase::FullLTOPostLink, - InlinePass::CGSCCInliner})); + if (EnableModuleInliner) { + MPM.addPass(ModuleInlinerPass(getInlineParamsFromOptLevel(Level), + UseInlineAdvisor, + ThinOrFullLTOPhase::FullLTOPostLink)); + } else { + MPM.addPass(ModuleInlinerWrapperPass( + getInlineParamsFromOptLevel(Level), + /* MandatoryFirst */ true, + InlineContext{ThinOrFullLTOPhase::FullLTOPostLink, + InlinePass::CGSCCInliner})); + } // Perform context disambiguation after inlining, since that would reduce the // amount of additional cloning required to distinguish the allocation