Coverage Report

Created: 2017-06-28 17:40

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/polly/lib/Analysis/PruneUnprofitable.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- PruneUnprofitable.cpp ------------------------------------*- C++ -*-===//
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
// Mark a SCoP as unfeasible if not deemed profitable to optimize.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#include "polly/PruneUnprofitable.h"
15
#include "polly/ScopInfo.h"
16
#include "polly/ScopPass.h"
17
#define DEBUG_TYPE "polly-prune-unprofitable"
18
19
using namespace polly;
20
using namespace llvm;
21
22
namespace {
23
24
STATISTIC(ScopsProcessed,
25
          "Number of SCoPs considered for unprofitability pruning");
26
STATISTIC(ScopsPruned, "Number of pruned SCoPs because it they cannot be "
27
                       "optimized in a significant way");
28
29
class PruneUnprofitable : public ScopPass {
30
private:
31
  PruneUnprofitable(const PruneUnprofitable &) = delete;
32
  const PruneUnprofitable &operator=(const PruneUnprofitable &) = delete;
33
34
public:
35
  static char ID;
36
0
  explicit PruneUnprofitable() : ScopPass(ID) {}
37
38
0
  virtual void getAnalysisUsage(AnalysisUsage &AU) const override {
39
0
    AU.addRequired<ScopInfoRegionPass>();
40
0
    AU.setPreservesAll();
41
0
  }
42
43
0
  virtual bool runOnScop(Scop &S) override {
44
0
    if (
PollyProcessUnprofitable0
)
{0
45
0
      DEBUG(dbgs() << "NOTE: -polly-process-unprofitable active, won't prune "
46
0
                      "anything\n");
47
0
      return false;
48
0
    }
49
0
50
0
    ScopsProcessed++;
51
0
52
0
    if (
!S.isProfitable(true)0
)
{0
53
0
      DEBUG(dbgs() << "SCoP pruned because it probably cannot be optimized in "
54
0
                      "a significant way\n");
55
0
      ScopsPruned++;
56
0
      S.invalidate(PROFITABLE, DebugLoc());
57
0
    }
58
0
59
0
    return false;
60
0
  }
61
};
62
63
char PruneUnprofitable::ID;
64
} // anonymous namespace
65
66
0
Pass *polly::createPruneUnprofitablePass() { return new PruneUnprofitable(); }
67
68
41.0k
INITIALIZE_PASS_BEGIN41.0k
(PruneUnprofitable, "polly-prune-unprofitable",41.0k
69
41.0k
                      "Polly - Prune unprofitable SCoPs", false, false)
70
41.0k
INITIALIZE_PASS_END(PruneUnprofitable, "polly-prune-unprofitable",
71
                    "Polly - Prune unprofitable SCoPs", false, false)