Files
clang-p2996/polly/lib/Transform/Canonicalization.cpp
Tobias Grosser 522478d2c0 clang-tidy: Add llvm namespace comments
llvm commonly adds a comment to the closing brace of a namespace to indicate
which namespace is closed. clang-tidy provides with llvm-namespace-comment
a handy tool to check for this habit. We use it to ensure we consitently use
namespace comments in Polly.

There are slightly different styles in how namespaces are closed in LLVM. As
there is no large difference between the different comment styles we go for the
style clang-tidy suggests by default.

To reproduce this fix run:

for i in `ls tools/polly/lib/*/*.cpp`; \
  clang-tidy -checks='-*,llvm-namespace-comment' -p build $i -fix \
  -header-filter=".*"; \
done

This cleanup was suggested by Eugene Zelenko <eugene.zelenko@gmail.com> in
http://reviews.llvm.org/D21488 and was split out to increase readability.

llvm-svn: 273621
2016-06-23 22:17:27 +00:00

94 lines
3.0 KiB
C++

//===---- Canonicalization.cpp - Run canonicalization passes --------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Run the set of default canonicalization passes.
//
// This pass is mainly used for debugging.
//
//===----------------------------------------------------------------------===//
#include "polly/Canonicalization.h"
#include "polly/LinkAllPasses.h"
#include "polly/Options.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Scalar.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());
PM.add(llvm::createCFGSimplificationPass());
PM.add(llvm::createTailCallEliminationPass());
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());
}
namespace {
class PollyCanonicalize : public ModulePass {
PollyCanonicalize(const PollyCanonicalize &) = delete;
const PollyCanonicalize &operator=(const PollyCanonicalize &) = delete;
public:
static char ID;
explicit PollyCanonicalize() : ModulePass(ID) {}
~PollyCanonicalize();
/// @name FunctionPass interface.
//@{
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
virtual void releaseMemory();
virtual bool runOnModule(Module &M);
virtual void print(raw_ostream &OS, const Module *) const;
//@}
};
} // namespace
PollyCanonicalize::~PollyCanonicalize() {}
void PollyCanonicalize::getAnalysisUsage(AnalysisUsage &AU) const {}
void PollyCanonicalize::releaseMemory() {}
bool PollyCanonicalize::runOnModule(Module &M) {
legacy::PassManager PM;
registerCanonicalicationPasses(PM);
PM.run(M);
return true;
}
void PollyCanonicalize::print(raw_ostream &OS, const Module *) const {}
char PollyCanonicalize::ID = 0;
Pass *polly::createPollyCanonicalizePass() { return new PollyCanonicalize(); }
INITIALIZE_PASS_BEGIN(PollyCanonicalize, "polly-canonicalize",
"Polly - Run canonicalization passes", false, false)
INITIALIZE_PASS_END(PollyCanonicalize, "polly-canonicalize",
"Polly - Run canonicalization passes", false, false)