Index: polly/trunk/include/polly/TempScopInfo.h =================================================================== --- polly/trunk/include/polly/TempScopInfo.h +++ polly/trunk/include/polly/TempScopInfo.h @@ -128,7 +128,6 @@ 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 @@ 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 @@ /// @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 @@ // 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 @@ void buildAccessFunctions(Region &RefRegion, BasicBlock &BB); - void buildLoopBounds(TempScop &Scop); - public: static char ID; explicit TempScopInfo() : FunctionPass(ID) {} Index: polly/trunk/lib/Analysis/ScopInfo.cpp =================================================================== --- polly/trunk/lib/Analysis/ScopInfo.cpp +++ polly/trunk/lib/Analysis/ScopInfo.cpp @@ -788,6 +788,7 @@ 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 @@ // 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); Index: polly/trunk/lib/Analysis/TempScopInfo.cpp =================================================================== --- polly/trunk/lib/Analysis/TempScopInfo.cpp +++ polly/trunk/lib/Analysis/TempScopInfo.cpp @@ -213,23 +213,6 @@ 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 @@ } 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 @@ void TempScopInfo::clear() { BBConds.clear(); - LoopBounds.clear(); AccFuncMap.clear(); DeleteContainerSeconds(TempScops); TempScops.clear();