Coverage Report

Created: 2017-10-03 07:32

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/polly/lib/Transform/Canonicalization.cpp
Line
Count
Source (jump to first uncovered line)
1
//===---- Canonicalization.cpp - Run canonicalization passes --------------===//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
//
10
// Run the set of default canonicalization passes.
11
//
12
// This pass is mainly used for debugging.
13
//
14
//===----------------------------------------------------------------------===//
15
16
#include "polly/Canonicalization.h"
17
#include "polly/LinkAllPasses.h"
18
#include "polly/Options.h"
19
#include "llvm/Transforms/IPO.h"
20
#include "llvm/Transforms/Scalar.h"
21
22
using namespace llvm;
23
using namespace polly;
24
25
static cl::opt<bool>
26
    PollyInliner("polly-run-inliner",
27
                 cl::desc("Run an early inliner pass before Polly"), cl::Hidden,
28
                 cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
29
30
1
void polly::registerCanonicalicationPasses(llvm::legacy::PassManagerBase &PM) {
31
1
  bool UseMemSSA = true;
32
1
  PM.add(polly::createRewriteByrefParamsPass());
33
1
  PM.add(llvm::createPromoteMemoryToRegisterPass());
34
1
  PM.add(llvm::createEarlyCSEPass(UseMemSSA));
35
1
  PM.add(llvm::createInstructionCombiningPass());
36
1
  PM.add(llvm::createCFGSimplificationPass());
37
1
  PM.add(llvm::createTailCallEliminationPass());
38
1
  PM.add(llvm::createCFGSimplificationPass());
39
1
  PM.add(llvm::createReassociatePass());
40
1
  PM.add(llvm::createLoopRotatePass());
41
1
  if (
PollyInliner1
) {
42
0
    PM.add(llvm::createFunctionInliningPass(200));
43
0
    PM.add(llvm::createPromoteMemoryToRegisterPass());
44
0
    PM.add(llvm::createCFGSimplificationPass());
45
0
    PM.add(llvm::createInstructionCombiningPass());
46
0
    PM.add(createBarrierNoopPass());
47
0
  }
48
1
  PM.add(llvm::createInstructionCombiningPass());
49
1
  PM.add(llvm::createIndVarSimplifyPass());
50
1
  PM.add(polly::createCodePreparationPass());
51
1
}
52
53
namespace {
54
class PollyCanonicalize : public ModulePass {
55
  PollyCanonicalize(const PollyCanonicalize &) = delete;
56
  const PollyCanonicalize &operator=(const PollyCanonicalize &) = delete;
57
58
public:
59
  static char ID;
60
61
1
  explicit PollyCanonicalize() : ModulePass(ID) {}
62
  ~PollyCanonicalize();
63
64
  /// @name FunctionPass interface.
65
  //@{
66
  virtual void getAnalysisUsage(AnalysisUsage &AU) const;
67
  virtual void releaseMemory();
68
  virtual bool runOnModule(Module &M);
69
  virtual void print(raw_ostream &OS, const Module *) const;
70
  //@}
71
};
72
} // namespace
73
74
1
PollyCanonicalize::~PollyCanonicalize() {}
75
76
1
void PollyCanonicalize::getAnalysisUsage(AnalysisUsage &AU) const {}
77
78
1
void PollyCanonicalize::releaseMemory() {}
79
80
1
bool PollyCanonicalize::runOnModule(Module &M) {
81
1
  legacy::PassManager PM;
82
1
  registerCanonicalicationPasses(PM);
83
1
  PM.run(M);
84
1
85
1
  return true;
86
1
}
87
88
1
void PollyCanonicalize::print(raw_ostream &OS, const Module *) const {}
89
90
char PollyCanonicalize::ID = 0;
91
92
0
Pass *polly::createPollyCanonicalizePass() { return new PollyCanonicalize(); }
93
94
41.7k
INITIALIZE_PASS_BEGIN41.7k
(PollyCanonicalize, "polly-canonicalize",
95
41.7k
                      "Polly - Run canonicalization passes", false, false)
96
41.7k
INITIALIZE_PASS_END(PollyCanonicalize, "polly-canonicalize",
97
                    "Polly - Run canonicalization passes", false, false)