Coverage Report

Created: 2017-04-28 04: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
  PM.add(llvm::createPromoteMemoryToRegisterPass());
32
1
  PM.add(llvm::createInstructionCombiningPass());
33
1
  PM.add(llvm::createCFGSimplificationPass());
34
1
  PM.add(llvm::createTailCallEliminationPass());
35
1
  PM.add(llvm::createCFGSimplificationPass());
36
1
  PM.add(llvm::createReassociatePass());
37
1
  PM.add(llvm::createLoopRotatePass());
38
1
  if (
PollyInliner1
)
{0
39
0
    PM.add(llvm::createFunctionInliningPass(200));
40
0
    PM.add(llvm::createPromoteMemoryToRegisterPass());
41
0
    PM.add(llvm::createCFGSimplificationPass());
42
0
    PM.add(llvm::createInstructionCombiningPass());
43
0
    PM.add(createBarrierNoopPass());
44
0
  }
45
1
  PM.add(llvm::createInstructionCombiningPass());
46
1
  PM.add(llvm::createIndVarSimplifyPass());
47
1
  PM.add(polly::createCodePreparationPass());
48
1
}
49
50
namespace {
51
class PollyCanonicalize : public ModulePass {
52
  PollyCanonicalize(const PollyCanonicalize &) = delete;
53
  const PollyCanonicalize &operator=(const PollyCanonicalize &) = delete;
54
55
public:
56
  static char ID;
57
58
1
  explicit PollyCanonicalize() : ModulePass(ID) {}
59
  ~PollyCanonicalize();
60
61
  /// @name FunctionPass interface.
62
  //@{
63
  virtual void getAnalysisUsage(AnalysisUsage &AU) const;
64
  virtual void releaseMemory();
65
  virtual bool runOnModule(Module &M);
66
  virtual void print(raw_ostream &OS, const Module *) const;
67
  //@}
68
};
69
} // namespace
70
71
1
PollyCanonicalize::~PollyCanonicalize() {}
72
73
1
void PollyCanonicalize::getAnalysisUsage(AnalysisUsage &AU) const {}
74
75
1
void PollyCanonicalize::releaseMemory() {}
76
77
1
bool PollyCanonicalize::runOnModule(Module &M) {
78
1
  legacy::PassManager PM;
79
1
  registerCanonicalicationPasses(PM);
80
1
  PM.run(M);
81
1
82
1
  return true;
83
1
}
84
85
1
void PollyCanonicalize::print(raw_ostream &OS, const Module *) const {}
86
87
char PollyCanonicalize::ID = 0;
88
89
0
Pass *polly::createPollyCanonicalizePass() { return new PollyCanonicalize(); }
90
91
39.7k
INITIALIZE_PASS_BEGIN39.7k
(PollyCanonicalize, "polly-canonicalize",39.7k
92
39.7k
                      "Polly - Run canonicalization passes", false, false)
93
39.7k
INITIALIZE_PASS_END(PollyCanonicalize, "polly-canonicalize",
94
                    "Polly - Run canonicalization passes", false, false)