[llvm] 1a36eaa - [Pass Builder] Allow Module Inliner for full LTO

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 3 05:16:45 PDT 2023


Author: ibricchi
Date: 2023-04-03T14:16:35+02:00
New Revision: 1a36eaa552f14e7376b38cf5fc54afdf52cc8f13

URL: https://github.com/llvm/llvm-project/commit/1a36eaa552f14e7376b38cf5fc54afdf52cc8f13
DIFF: https://github.com/llvm/llvm-project/commit/1a36eaa552f14e7376b38cf5fc54afdf52cc8f13.diff

LOG: [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

Added: 
    

Modified: 
    llvm/lib/Passes/PassBuilderPipelines.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index aaabe23049288..ed085b437ae95 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


        


More information about the llvm-commits mailing list