summaryrefslogtreecommitdiffstats
path: root/polly/lib
diff options
context:
space:
mode:
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>2014-11-01 00:12:13 +0000
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>2014-11-01 00:12:13 +0000
commite3da05ac323e0ac91a0cdd2d73d0908d0d17412d (patch)
tree4078b2577440beb446cf325a0157d5eba6c0ea96 /polly/lib
parent1d558b84efb91471b9257cb093c7f59a97ddc3d5 (diff)
downloadbcm5719-llvm-e3da05ac323e0ac91a0cdd2d73d0908d0d17412d.tar.gz
bcm5719-llvm-e3da05ac323e0ac91a0cdd2d73d0908d0d17412d.zip
Remove the MaxLoopDepth attribute from the TempScop class
Now MaxLoopDepth only lives in Scops not in TempScops anymore. This is the first part of a series of changes to make TempScops obsolete. Differential Revision: http://reviews.llvm.org/D6069 llvm-svn: 221026
Diffstat (limited to 'polly/lib')
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp24
-rw-r--r--polly/lib/Analysis/TempScopInfo.cpp12
2 files changed, 23 insertions, 13 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index ebf1d977605..89696e21e0a 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -1416,10 +1416,30 @@ bool Scop::buildAliasGroups(AliasAnalysis &AA) {
return Valid;
}
+static unsigned getMaxLoopDepthInRegion(const Region &R, LoopInfo &LI) {
+ unsigned MinLD = INT_MAX, MaxLD = 0;
+ for (BasicBlock *BB : R.blocks()) {
+ if (Loop *L = LI.getLoopFor(BB)) {
+ unsigned LD = L->getLoopDepth();
+ MinLD = std::min(MinLD, LD);
+ MaxLD = std::max(MaxLD, LD);
+ }
+ }
+
+ // Handle the case that there is no loop in the SCoP first.
+ if (MaxLD == 0)
+ return 1;
+
+ assert(MinLD >= 1 && "Minimal loop depth should be at least one");
+ assert(MaxLD >= MinLD &&
+ "Maximal loop depth was smaller than mininaml loop depth?");
+ return MaxLD - MinLD + 1;
+}
+
Scop::Scop(TempScop &tempScop, LoopInfo &LI, ScalarEvolution &ScalarEvolution,
isl_ctx *Context)
: SE(&ScalarEvolution), R(tempScop.getMaxRegion()),
- MaxLoopDepth(tempScop.getMaxLoopDepth()) {
+ MaxLoopDepth(getMaxLoopDepthInRegion(tempScop.getMaxRegion(), LI)) {
IslCtx = Context;
buildContext();
@@ -1785,7 +1805,7 @@ bool ScopInfo::runOnRegion(Region *R, RGPassManager &RGM) {
// Statistics.
++ScopFound;
- if (tempScop->getMaxLoopDepth() > 0)
+ if (scop->getMaxLoopDepth() > 0)
++RichScopFound;
scop = new Scop(*tempScop, LI, SE, ctx);
diff --git a/polly/lib/Analysis/TempScopInfo.cpp b/polly/lib/Analysis/TempScopInfo.cpp
index befb731fe09..570389b43c3 100644
--- a/polly/lib/Analysis/TempScopInfo.cpp
+++ b/polly/lib/Analysis/TempScopInfo.cpp
@@ -73,8 +73,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, const BBCond &Cond) {
TempScop::~TempScop() {}
void TempScop::print(raw_ostream &OS, ScalarEvolution *SE, LoopInfo *LI) const {
- OS << "Scop: " << R.getNameStr() << ", Max Loop Depth: " << MaxLoopDepth
- << "\n";
+ OS << "Scop: " << R.getNameStr() << "\n";
printDetail(OS, SE, LI, &R, 0);
}
@@ -216,7 +215,6 @@ void TempScopInfo::buildAccessFunctions(Region &R, BasicBlock &BB) {
void TempScopInfo::buildLoopBounds(TempScop &Scop) {
Region &R = Scop.getMaxRegion();
- unsigned MaxLoopDepth = 0;
for (auto const &BB : R.blocks()) {
Loop *L = LI->getLoopFor(BB);
@@ -229,15 +227,7 @@ void TempScopInfo::buildLoopBounds(TempScop &Scop) {
const SCEV *BackedgeTakenCount = SE->getBackedgeTakenCount(L);
LoopBounds[L] = BackedgeTakenCount;
-
- Loop *OL = R.outermostLoopInRegion(L);
- unsigned LoopDepth = L->getLoopDepth() - OL->getLoopDepth() + 1;
-
- if (LoopDepth > MaxLoopDepth)
- MaxLoopDepth = LoopDepth;
}
-
- Scop.MaxLoopDepth = MaxLoopDepth;
}
void TempScopInfo::buildAffineCondition(Value &V, bool inverted,
OpenPOWER on IntegriCloud