add NestLoops to remove some uses of IVS
authorSebastian Pop <spop@codeaurora.org>
Fri, 15 Feb 2013 21:26:44 +0000 (21:26 +0000)
committerSebastian Pop <spop@codeaurora.org>
Fri, 15 Feb 2013 21:26:44 +0000 (21:26 +0000)
llvm-svn: 175303

polly/include/polly/ScopInfo.h
polly/lib/Analysis/ScopInfo.cpp

index 15c3261..7b2ab13 100755 (executable)
@@ -277,6 +277,7 @@ class ScopStmt {
   ///
   /// This information is only needed for final code generation.
   std::vector<std::pair<PHINode*, Loop*> > IVS;
+  std::vector<Loop*> NestLoops;
 
   std::string BaseName;
 
index e361b6a..19ef3b3 100644 (file)
@@ -586,14 +586,15 @@ ScopStmt::buildDomain(TempScop &tempScop, const Region &CurRegion) {
 }
 
 ScopStmt::ScopStmt(Scop &parent, TempScop &tempScop, const Region &CurRegion,
-                   BasicBlock &bb, SmallVectorImpl<Loop *> &NestLoops,
+                   BasicBlock &bb, SmallVectorImpl<Loop *> &Nest,
                    SmallVectorImpl<unsigned> &Scatter)
-    : Parent(parent), BB(&bb), IVS(NestLoops.size()) {
+  : Parent(parent), BB(&bb), IVS(Nest.size()), NestLoops(Nest.size()) {
   // Setup the induction variables.
-  for (unsigned i = 0, e = NestLoops.size(); i < e; ++i) {
-    PHINode *PN = NestLoops[i]->getCanonicalInductionVariable();
+  for (unsigned i = 0, e = Nest.size(); i < e; ++i) {
+    PHINode *PN = Nest[i]->getCanonicalInductionVariable();
     assert(PN && "Non canonical IV in Scop!");
-    IVS[i] = std::make_pair(PN, NestLoops[i]);
+    IVS[i] = std::make_pair(PN, Nest[i]);
+    NestLoops[i] = Nest[i];
   }
 
   raw_string_ostream OS(BaseName);
@@ -621,7 +622,7 @@ unsigned ScopStmt::getNumIterators() const {
   if (!BB)
     return 1;
 
-  return IVS.size();
+  return NestLoops.size();
 }
 
 unsigned ScopStmt::getNumScattering() const {
@@ -636,7 +637,7 @@ ScopStmt::getInductionVariableForDimension(unsigned Dimension) const {
 }
 
 const Loop *ScopStmt::getLoopForDimension(unsigned Dimension) const {
-  return IVS[Dimension].second;
+  return NestLoops[Dimension];
 }
 
 isl_ctx *ScopStmt::getIslCtx() const { return Parent.getIslCtx(); }