[llvm] r216178 - Handle inlining in populateLTOPassManager like in populateModulePassManager.

Rafael Espindola rafael.espindola at gmail.com
Thu Aug 21 06:35:30 PDT 2014


Author: rafael
Date: Thu Aug 21 08:35:30 2014
New Revision: 216178

URL: http://llvm.org/viewvc/llvm-project?rev=216178&view=rev
Log:
Handle inlining in populateLTOPassManager like in populateModulePassManager.

No functionality change.

Modified:
    llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h
    llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
    llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
    llvm/trunk/tools/bugpoint/bugpoint.cpp
    llvm/trunk/tools/opt/opt.cpp

Modified: llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h?rev=216178&r1=216177&r2=216178&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h Thu Aug 21 08:35:30 2014
@@ -145,7 +145,7 @@ public:
 
   /// populateModulePassManager - This sets up the primary pass manager.
   void populateModulePassManager(PassManagerBase &MPM);
-  void populateLTOPassManager(PassManagerBase &PM, bool RunInliner);
+  void populateLTOPassManager(PassManagerBase &PM);
 };
 
 /// Registers a function for adding a standard set of passes.  This should be

Modified: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=216178&r1=216177&r2=216178&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp Thu Aug 21 08:35:30 2014
@@ -477,7 +477,9 @@ bool LTOCodeGenerator::generateObjectFil
   if (!DisableOpt) {
     PassManagerBuilder PMB;
     PMB.DisableGVNLoadPRE = DisableGVNLoadPRE;
-    PMB.populateLTOPassManager(passes, !DisableInline);
+    if (!DisableInline)
+      PMB.Inliner = createFunctionInliningPass();
+    PMB.populateLTOPassManager(passes);
   }
 
   // Make sure everything is still good.

Modified: llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp?rev=216178&r1=216177&r2=216178&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp Thu Aug 21 08:35:30 2014
@@ -313,8 +313,7 @@ void PassManagerBuilder::populateModuleP
   addExtensionsToPM(EP_OptimizerLast, MPM);
 }
 
-void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM,
-                                                bool RunInliner) {
+void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM) {
   // Provide AliasAnalysis services for optimizations.
   addInitialAliasAnalysisPasses(PM);
 
@@ -341,8 +340,11 @@ void PassManagerBuilder::populateLTOPass
   addExtensionsToPM(EP_Peephole, PM);
 
   // Inline small functions
-  if (RunInliner)
-    PM.add(createFunctionInliningPass());
+  bool RunInliner = Inliner;
+  if (RunInliner) {
+    PM.add(Inliner);
+    Inliner = nullptr;
+  }
 
   PM.add(createPruneEHPass());   // Remove dead EH info.
 
@@ -483,5 +485,11 @@ void LLVMPassManagerBuilderPopulateLTOPa
                                                   LLVMBool RunInliner) {
   PassManagerBuilder *Builder = unwrap(PMB);
   PassManagerBase *LPM = unwrap(PM);
-  Builder->populateLTOPassManager(*LPM, RunInliner != 0);
+
+  // A small backwards compatibility hack. populateLTOPassManager used to take
+  // an RunInliner option.
+  if (RunInliner && !Builder->Inliner)
+    Builder->Inliner = createFunctionInliningPass();
+
+  Builder->populateLTOPassManager(*LPM);
 }

Modified: llvm/trunk/tools/bugpoint/bugpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/bugpoint.cpp?rev=216178&r1=216177&r2=216178&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/bugpoint.cpp (original)
+++ llvm/trunk/tools/bugpoint/bugpoint.cpp Thu Aug 21 08:35:30 2014
@@ -179,7 +179,8 @@ int main(int argc, char **argv) {
 
   if (StandardLinkOpts) {
     PassManagerBuilder Builder;
-    Builder.populateLTOPassManager(PM, /*RunInliner=*/true);
+    Builder.Inliner = createFunctionInliningPass();
+    Builder.populateLTOPassManager(PM);
   }
 
   if (OptLevelO1 || OptLevelO2 || OptLevelO3) {

Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=216178&r1=216177&r2=216178&view=diff
==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Thu Aug 21 08:35:30 2014
@@ -267,7 +267,9 @@ static void AddStandardLinkPasses(PassMa
   if (DisableOptimizations) return;
 
   PassManagerBuilder Builder;
-  Builder.populateLTOPassManager(PM, /*RunInliner=*/!DisableInline);
+  if (!DisableInline)
+    Builder.Inliner = createFunctionInliningPass();
+  Builder.populateLTOPassManager(PM);
 }
 
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list