17#include "llvm/ADT/Statistic.h"
18#include "llvm/IR/DebugLoc.h"
19#include "llvm/Support/Debug.h"
20#include "llvm/Support/raw_ostream.h"
26#define DEBUG_TYPE "polly-prune-unprofitable"
31 "Number of SCoPs considered for unprofitability pruning");
32STATISTIC(ScopsPruned,
"Number of pruned SCoPs because it they cannot be "
33 "optimized in a significant way");
34STATISTIC(ScopsSurvived,
"Number of SCoPs after pruning");
36STATISTIC(NumPrunedLoops,
"Number of pruned loops");
37STATISTIC(NumPrunedBoxedLoops,
"Number of pruned boxed loops");
38STATISTIC(NumPrunedAffineLoops,
"Number of pruned affine loops");
40STATISTIC(NumLoopsInScop,
"Number of loops in scops after pruning");
41STATISTIC(NumBoxedLoops,
"Number of boxed loops in SCoPs after pruning");
42STATISTIC(NumAffineLoops,
"Number of affine loops in SCoPs after pruning");
44static void updateStatistics(
Scop &
S,
bool Pruned) {
59static bool runPruneUnprofitable(
Scop &
S) {
62 dbgs() <<
"NOTE: -polly-process-unprofitable active, won't prune "
69 if (!
S.isProfitable(
true)) {
71 dbgs() <<
"SCoP pruned because it probably cannot be optimized in "
72 "a significant way\n");
74 updateStatistics(
S,
true);
76 updateStatistics(
S,
false);
82class PruneUnprofitableWrapperPass final :
public ScopPass {
86 explicit PruneUnprofitableWrapperPass() :
ScopPass(ID) {}
87 PruneUnprofitableWrapperPass(
const PruneUnprofitableWrapperPass &) =
delete;
88 PruneUnprofitableWrapperPass &
89 operator=(
const PruneUnprofitableWrapperPass &) =
delete;
100char PruneUnprofitableWrapperPass::ID;
103 return new PruneUnprofitableWrapperPass();
107 "Polly - Prune unprofitable SCoPs",
false,
false)
111llvm::PreservedAnalyses
114 bool Changed = runPruneUnprofitable(
S);
117 return PreservedAnalyses::all();
119 PreservedAnalyses PA;
120 PA.preserveSet<AllAnalysesOn<Module>>();
121 PA.preserveSet<AllAnalysesOn<Function>>();
122 PA.preserveSet<AllAnalysesOn<Loop>>();
INITIALIZE_PASS_END(DependenceInfo, "polly-dependences", "Polly - Calculate dependences", false, false) namespace
INITIALIZE_PASS_BEGIN(PruneUnprofitableWrapperPass, "polly-prune-unprofitable", "Polly - Prune unprofitable SCoPs", false, false) INITIALIZE_PASS_END(PruneUnprofitableWrapperPass
polly prune Polly Prune unprofitable SCoPs
STATISTIC(ScopFound, "Number of valid Scops")
The legacy pass manager's analysis pass to compute scop information for a region.
ScopPass - This class adapts the RegionPass interface to allow convenient creation of passes that ope...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
virtual bool runOnScop(Scop &S)=0
runOnScop - This method must be overloaded to perform the desired Polyhedral transformation or analys...
This file contains the declaration of the PolyhedralInfo class, which will provide an interface to ex...
bool PollyProcessUnprofitable
llvm::Pass * createPruneUnprofitableWrapperPass()
AnalysisManager< Scop, ScopStandardAnalysisResults & > ScopAnalysisManager