[polly] r250092 - RegisterPasses: Optionally run inliner before Polly

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 13:03:44 PDT 2015


Author: grosser
Date: Mon Oct 12 15:03:44 2015
New Revision: 250092

URL: http://llvm.org/viewvc/llvm-project?rev=250092&view=rev
Log:
RegisterPasses: Optionally run inliner before Polly

This will allow us to optimize C++ template code with Polly. This support is
mostly for debugging purpose and individual experiments. The ultimate goal is
still to run Polly later in the pass manager when inlining already happened.

Modified:
    polly/trunk/lib/Transform/Canonicalization.cpp

Modified: polly/trunk/lib/Transform/Canonicalization.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/Canonicalization.cpp?rev=250092&r1=250091&r2=250092&view=diff
==============================================================================
--- polly/trunk/lib/Transform/Canonicalization.cpp (original)
+++ polly/trunk/lib/Transform/Canonicalization.cpp Mon Oct 12 15:03:44 2015
@@ -14,12 +14,19 @@
 //===----------------------------------------------------------------------===//
 
 #include "polly/LinkAllPasses.h"
+#include "polly/Options.h"
 #include "polly/Canonicalization.h"
 #include "llvm/Transforms/Scalar.h"
+#include "llvm/Transforms/IPO.h"
 
 using namespace llvm;
 using namespace polly;
 
+static cl::opt<bool>
+    PollyInliner("polly-run-inliner",
+                 cl::desc("Run an early inliner pass before Polly"), cl::Hidden,
+                 cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
+
 void polly::registerCanonicalicationPasses(llvm::legacy::PassManagerBase &PM) {
   PM.add(llvm::createPromoteMemoryToRegisterPass());
   PM.add(llvm::createInstructionCombiningPass());
@@ -28,6 +35,12 @@ void polly::registerCanonicalicationPass
   PM.add(llvm::createCFGSimplificationPass());
   PM.add(llvm::createReassociatePass());
   PM.add(llvm::createLoopRotatePass());
+  if (PollyInliner) {
+    PM.add(llvm::createFunctionInliningPass(200));
+    PM.add(llvm::createCFGSimplificationPass());
+    PM.add(llvm::createInstructionCombiningPass());
+    PM.add(createBarrierNoopPass());
+  }
   PM.add(llvm::createInstructionCombiningPass());
   PM.add(llvm::createIndVarSimplifyPass());
   PM.add(polly::createCodePreparationPass());




More information about the llvm-commits mailing list