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.

llvm-svn: 250092
This commit is contained in:
Tobias Grosser 2015-10-12 20:03:44 +00:00
parent d17183f20f
commit f30be2f370

View File

@ -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::registerCanonicalicationPasses(llvm::legacy::PassManagerBase &PM) {
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());