diff options
author | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2014-11-01 00:12:13 +0000 |
---|---|---|
committer | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2014-11-01 00:12:13 +0000 |
commit | e3da05ac323e0ac91a0cdd2d73d0908d0d17412d (patch) | |
tree | 4078b2577440beb446cf325a0157d5eba6c0ea96 | |
parent | 1d558b84efb91471b9257cb093c7f59a97ddc3d5 (diff) | |
download | bcm5719-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
-rw-r--r-- | polly/include/polly/TempScopInfo.h | 11 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 24 | ||||
-rw-r--r-- | polly/lib/Analysis/TempScopInfo.cpp | 12 |
3 files changed, 24 insertions, 23 deletions
diff --git a/polly/include/polly/TempScopInfo.h b/polly/include/polly/TempScopInfo.h index eb57c1f7c68..f43863c00f4 100644 --- a/polly/include/polly/TempScopInfo.h +++ b/polly/include/polly/TempScopInfo.h @@ -127,9 +127,6 @@ class TempScop { // The Region. Region &R; - // The max loop depth of this Scop - unsigned MaxLoopDepth; - // Remember the bounds of loops, to help us build iteration domain of BBs. const LoopBoundMapType &LoopBounds; const BBCondMapType &BBConds; @@ -141,8 +138,7 @@ class TempScop { explicit TempScop(Region &r, LoopBoundMapType &loopBounds, BBCondMapType &BBCmps, AccFuncMapType &accFuncMap) - : R(r), MaxLoopDepth(0), LoopBounds(loopBounds), BBConds(BBCmps), - AccFuncMap(accFuncMap) {} + : R(r), LoopBounds(loopBounds), BBConds(BBCmps), AccFuncMap(accFuncMap) {} public: ~TempScop(); @@ -152,11 +148,6 @@ public: /// @return The maximum Region contained by this Scop. Region &getMaxRegion() const { return R; } - /// @brief Get the maximum loop depth of Region R. - /// - /// @return The maximum loop depth of Region R. - unsigned getMaxLoopDepth() const { return MaxLoopDepth; } - /// @brief Get the loop bounds of the given loop. /// /// @param L The loop to get the bounds. 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, |