[PATCH] D146805: [Pass Builder] Allow Module Inliner for full lto

IBricchi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 24 04:44:48 PDT 2023


IBricchi created this revision.
Herald added subscribers: hiraditya, inglorion.
Herald added a project: All.
IBricchi requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Currently there is no way to enable the module inliner
when linking with -flto=full. This patch enables that
option.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146805

Files:
  llvm/lib/Passes/PassBuilderPipelines.cpp


Index: llvm/lib/Passes/PassBuilderPipelines.cpp
===================================================================
--- llvm/lib/Passes/PassBuilderPipelines.cpp
+++ llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -1708,11 +1708,16 @@
   // valuable as the inliner doesn't currently care whether it is inlining an
   // invoke or a call.
   // Run the inliner now.
-  MPM.addPass(ModuleInlinerWrapperPass(
+  if (EnableModuleInliner){
+    MPM.addPass(buildModuleInlinerPipeline(Level, 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146805.508051.patch
Type: text/x-patch
Size: 924 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230324/08b44de4/attachment.bin>


More information about the llvm-commits mailing list