Skip to content

Commit 1a36eaa

Browse files
ibricchinikic
authored andcommitted
[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
1 parent db3dcdc commit 1a36eaa

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

llvm/lib/Passes/PassBuilderPipelines.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,11 +1708,17 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
17081708
// valuable as the inliner doesn't currently care whether it is inlining an
17091709
// invoke or a call.
17101710
// Run the inliner now.
1711-
MPM.addPass(ModuleInlinerWrapperPass(
1712-
getInlineParamsFromOptLevel(Level),
1713-
/* MandatoryFirst */ true,
1714-
InlineContext{ThinOrFullLTOPhase::FullLTOPostLink,
1715-
InlinePass::CGSCCInliner}));
1711+
if (EnableModuleInliner) {
1712+
MPM.addPass(ModuleInlinerPass(getInlineParamsFromOptLevel(Level),
1713+
UseInlineAdvisor,
1714+
ThinOrFullLTOPhase::FullLTOPostLink));
1715+
} else {
1716+
MPM.addPass(ModuleInlinerWrapperPass(
1717+
getInlineParamsFromOptLevel(Level),
1718+
/* MandatoryFirst */ true,
1719+
InlineContext{ThinOrFullLTOPhase::FullLTOPostLink,
1720+
InlinePass::CGSCCInliner}));
1721+
}
17161722

17171723
// Perform context disambiguation after inlining, since that would reduce the
17181724
// amount of additional cloning required to distinguish the allocation

0 commit comments

Comments
 (0)