From 5ad8a6a588d8e00b0c5e16271621dddf0a700242 Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Sat, 1 Nov 2014 01:14:56 +0000 Subject: [PATCH] Remove the LoopBounds from the TempScop class. We will use ScalarEvolution in the ScopInfo.cpp to get the loop trip count, not cache it in the TempScop object. Differential Revision: http://reviews.llvm.org/D6070 llvm-svn: 221035 --- polly/include/polly/TempScopInfo.h | 24 +++--------------------- polly/lib/Analysis/ScopInfo.cpp | 3 ++- polly/lib/Analysis/TempScopInfo.cpp | 22 +--------------------- 3 files changed, 6 insertions(+), 43 deletions(-) diff --git a/polly/include/polly/TempScopInfo.h b/polly/include/polly/TempScopInfo.h index f43863c..cc23ccc 100644 --- a/polly/include/polly/TempScopInfo.h +++ b/polly/include/polly/TempScopInfo.h @@ -128,7 +128,6 @@ class TempScop { Region &R; // Remember the bounds of loops, to help us build iteration domain of BBs. - const LoopBoundMapType &LoopBounds; const BBCondMapType &BBConds; // Access function of bbs. @@ -136,9 +135,9 @@ class TempScop { friend class TempScopInfo; - explicit TempScop(Region &r, LoopBoundMapType &loopBounds, - BBCondMapType &BBCmps, AccFuncMapType &accFuncMap) - : R(r), LoopBounds(loopBounds), BBConds(BBCmps), AccFuncMap(accFuncMap) {} + explicit TempScop(Region &r, BBCondMapType &BBCmps, + AccFuncMapType &accFuncMap) + : R(r), BBConds(BBCmps), AccFuncMap(accFuncMap) {} public: ~TempScop(); @@ -148,18 +147,6 @@ public: /// @return The maximum Region contained by this Scop. Region &getMaxRegion() const { return R; } - /// @brief Get the loop bounds of the given loop. - /// - /// @param L The loop to get the bounds. - /// - /// @return The bounds of the loop L in { Lower bound, Upper bound } form. - /// - const SCEV *getLoopBound(const Loop *L) const { - LoopBoundMapType::const_iterator at = LoopBounds.find(L); - assert(at != LoopBounds.end() && "Bound for loop not available!"); - return at->second; - } - /// @brief Get the condition from entry block of the Scop to a BasicBlock /// /// @param BB The BasicBlock @@ -229,9 +216,6 @@ class TempScopInfo : public FunctionPass { // Target data for element size computing. const DataLayout *TD; - // Remember the bounds of loops, to help us build iteration domain of BBs. - LoopBoundMapType LoopBounds; - // And also Remember the constrains for BBs BBCondMapType BBConds; @@ -288,8 +272,6 @@ class TempScopInfo : public FunctionPass { void buildAccessFunctions(Region &RefRegion, BasicBlock &BB); - void buildLoopBounds(TempScop &Scop); - public: static char ID; explicit TempScopInfo() : FunctionPass(ID) {} diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index 89696e2..3ce42a0 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -788,6 +788,7 @@ __isl_give isl_set *ScopStmt::addLoopBoundsToDomain(__isl_take isl_set *Domain, Space = isl_set_get_space(Domain); LocalSpace = isl_local_space_from_space(Space); + ScalarEvolution *SE = getParent()->getSE(); for (int i = 0, e = getNumIterators(); i != e; ++i) { isl_aff *Zero = isl_aff_zero_on_domain(isl_local_space_copy(LocalSpace)); isl_pw_aff *IV = @@ -799,7 +800,7 @@ __isl_give isl_set *ScopStmt::addLoopBoundsToDomain(__isl_take isl_set *Domain, // IV <= LatchExecutions. const Loop *L = getLoopForDimension(i); - const SCEV *LatchExecutions = tempScop.getLoopBound(L); + const SCEV *LatchExecutions = SE->getBackedgeTakenCount(L); isl_pw_aff *UpperBound = SCEVAffinator::getPwAff(this, LatchExecutions); isl_set *UpperBoundSet = isl_pw_aff_le_set(IV, UpperBound); Domain = isl_set_intersect(Domain, UpperBoundSet); diff --git a/polly/lib/Analysis/TempScopInfo.cpp b/polly/lib/Analysis/TempScopInfo.cpp index 570389b..b7ab549 100644 --- a/polly/lib/Analysis/TempScopInfo.cpp +++ b/polly/lib/Analysis/TempScopInfo.cpp @@ -213,23 +213,6 @@ void TempScopInfo::buildAccessFunctions(Region &R, BasicBlock &BB) { Accs.insert(Accs.end(), Functions.begin(), Functions.end()); } -void TempScopInfo::buildLoopBounds(TempScop &Scop) { - Region &R = Scop.getMaxRegion(); - - for (auto const &BB : R.blocks()) { - Loop *L = LI->getLoopFor(BB); - - if (!L || !R.contains(L)) - continue; - - if (LoopBounds.find(L) != LoopBounds.end()) - continue; - - const SCEV *BackedgeTakenCount = SE->getBackedgeTakenCount(L); - LoopBounds[L] = BackedgeTakenCount; - } -} - void TempScopInfo::buildAffineCondition(Value &V, bool inverted, Comparison **Comp) const { if (ConstantInt *C = dyn_cast(&V)) { @@ -312,15 +295,13 @@ void TempScopInfo::buildCondition(BasicBlock *BB, BasicBlock *RegionEntry) { } TempScop *TempScopInfo::buildTempScop(Region &R) { - TempScop *TScop = new TempScop(R, LoopBounds, BBConds, AccFuncMap); + TempScop *TScop = new TempScop(R, BBConds, AccFuncMap); for (const auto &BB : R.blocks()) { buildAccessFunctions(R, *BB); buildCondition(BB, R.getEntry()); } - buildLoopBounds(*TScop); - return TScop; } @@ -372,7 +353,6 @@ TempScopInfo::~TempScopInfo() { clear(); } void TempScopInfo::clear() { BBConds.clear(); - LoopBounds.clear(); AccFuncMap.clear(); DeleteContainerSeconds(TempScops); TempScops.clear(); -- 2.7.4