Coverage Report

Created: 2017-08-18 19:41

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