]> granicus.if.org Git - llvm/commitdiff
[PartialInlining] Add internal options to enable partial inlining in pass pipeline...
authorXinliang David Li <davidxl@google.com>
Mon, 22 May 2017 16:41:57 +0000 (16:41 +0000)
committerXinliang David Li <davidxl@google.com>
Mon, 22 May 2017 16:41:57 +0000 (16:41 +0000)
1. Legacy: -mllvm -enable-partial-inlining
2. New:  -mllvm -enable-npm-partial-inlining -fexperimental-new-pass-manager

Differential Revision: http://reviews.llvm.org/D33382

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303567 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Passes/PassBuilder.cpp
lib/Transforms/IPO/PassManagerBuilder.cpp

index 7076e751071dcc2c2b84f4949b759af95508f8c7..6ece7965ce64691451b2522a56a15f2c16809895 100644 (file)
@@ -150,6 +150,10 @@ using namespace llvm;
 
 static cl::opt<unsigned> MaxDevirtIterations("pm-max-devirt-iterations",
                                              cl::ReallyHidden, cl::init(4));
+static cl::opt<bool>
+    RunPartialInlining("enable-npm-partial-inlining", cl::init(false),
+                       cl::Hidden, cl::ZeroOrMore,
+                       cl::desc("Run Partial inlinining pass"));
 
 static cl::opt<bool> EnableGVNHoist(
     "enable-npm-gvn-hoist", cl::init(false), cl::Hidden,
@@ -552,6 +556,11 @@ PassBuilder::buildPerModuleDefaultPipeline(OptimizationLevel Level,
   // At this point, we expect to have canonical and simple IR which we begin
   // *optimizing* for efficient execution going forward.
 
+  // Run partial inlining pass to partially inline functions that have
+  // large bodies.
+  if (RunPartialInlining)
+    MPM.addPass(PartialInlinerPass());
+
   // Eliminate externally available functions now that inlining is over -- we
   // won't emit these anyways.
   MPM.addPass(EliminateAvailableExternallyPass());
index 203594572618af740697d8db226c780c15379a8f..ec06d5f9fb05bba3901dc657ea94edb5ce6cd0aa 100644 (file)
 using namespace llvm;
 
 static cl::opt<bool>
-RunLoopVectorization("vectorize-loops", cl::Hidden,
-                     cl::desc("Run the Loop vectorization passes"));
+    RunPartialInlining("enable-partial-inlining", cl::init(false), cl::Hidden,
+                       cl::ZeroOrMore, cl::desc("Run Partial inlinining pass"));
+
+static cl::opt<bool>
+    RunLoopVectorization("vectorize-loops", cl::Hidden,
+                         cl::desc("Run the Loop vectorization passes"));
 
 static cl::opt<bool>
 RunSLPVectorization("vectorize-slp", cl::Hidden,
@@ -516,6 +520,8 @@ void PassManagerBuilder::populateModulePassManager(
   // pass manager that we are specifically trying to avoid. To prevent this
   // we must insert a no-op module pass to reset the pass manager.
   MPM.add(createBarrierNoopPass());
+  if (RunPartialInlining)
+    MPM.add(createPartialInliningPass());
 
   if (!DisableUnitAtATime && OptLevel > 1 && !PrepareForLTO &&
       !PrepareForThinLTO)