[polly] r221035 - Remove the LoopBounds from the TempScop class.

Johannes Doerfert doerfert at cs.uni-saarland.de
Fri Oct 31 18:14:56 PDT 2014


Author: jdoerfert
Date: Fri Oct 31 20:14:56 2014
New Revision: 221035

URL: http://llvm.org/viewvc/llvm-project?rev=221035&view=rev
Log:
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

Modified:
    polly/trunk/include/polly/TempScopInfo.h
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/lib/Analysis/TempScopInfo.cpp

Modified: polly/trunk/include/polly/TempScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/TempScopInfo.h?rev=221035&r1=221034&r2=221035&view=diff
==============================================================================
--- polly/trunk/include/polly/TempScopInfo.h (original)
+++ polly/trunk/include/polly/TempScopInfo.h Fri Oct 31 20:14:56 2014
@@ -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) {}

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=221035&r1=221034&r2=221035&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Fri Oct 31 20:14:56 2014
@@ -788,6 +788,7 @@ __isl_give isl_set *ScopStmt::addLoopBou
   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::addLoopBou
 
     // 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);

Modified: polly/trunk/lib/Analysis/TempScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/TempScopInfo.cpp?rev=221035&r1=221034&r2=221035&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/TempScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/TempScopInfo.cpp Fri Oct 31 20:14:56 2014
@@ -213,23 +213,6 @@ void TempScopInfo::buildAccessFunctions(
   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<ConstantInt>(&V)) {
@@ -312,15 +295,13 @@ void TempScopInfo::buildCondition(BasicB
 }
 
 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();





More information about the llvm-commits mailing list