[llvm-commits] [polly] r144084 - in /polly/trunk: include/polly/ScopInfo.h lib/Analysis/ScopInfo.cpp

Tobias Grosser grosser at fim.uni-passau.de
Tue Nov 8 07:41:08 PST 2011


Author: grosser
Date: Tue Nov  8 09:41:08 2011
New Revision: 144084

URL: http://llvm.org/viewvc/llvm-project?rev=144084&view=rev
Log:
ScopInfo: Realign parameters after the scop is built

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

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=144084&r1=144083&r2=144084&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Tue Nov  8 09:41:08 2011
@@ -154,6 +154,10 @@
 
   /// @brief Set the updated access relation read from JSCOP file.
   void setNewAccessRelation(isl_map *newAccessRelation);
+
+  /// @brief Align the parameters in the access relation to the scop context
+  void realignParams();
+
   /// @brief Print the MemoryAccess.
   ///
   /// @param OS The output stream the MemoryAccess is printed to.
@@ -345,6 +349,9 @@
   /// that all data used in the Scop is read after the Scop.
   bool isFinalRead() { return getBasicBlock() == NULL; }
 
+  /// @brief Align the parameters in the statement to the scop context
+  void realignParams();
+
   /// @brief Print the ScopStmt.
   ///
   /// @param OS The output stream the ScopStmt is printed to.
@@ -540,6 +547,9 @@
   const_reverse_iterator rend()   const { return Stmts.rend();   }
   //@}
 
+  /// @brief Align the parameters in the statement to the scop context
+  void realignParams();
+
   /// @brief Print the static control part.
   ///
   /// @param OS The output stream the static control part is printed to.

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=144084&r1=144083&r2=144084&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Tue Nov  8 09:41:08 2011
@@ -342,8 +342,10 @@
                                           Statement->getBaseName());
   AccessRelation = isl_map_set_tuple_name(AccessRelation, isl_dim_out,
                                           getBaseName().c_str());
+}
 
-  isl_space *ParamSpace = Statement->getParent()->getParamSpace();
+void MemoryAccess::realignParams() {
+  isl_space *ParamSpace = statement->getParent()->getParamSpace();
   AccessRelation = isl_map_align_params(AccessRelation, ParamSpace);
 }
 
@@ -587,6 +589,14 @@
   }
 }
 
+void ScopStmt::realignParams() {
+  for (memacc_iterator MI = memacc_begin(), ME = memacc_end(); MI != ME; ++MI)
+    (*MI)->realignParams();
+
+  Domain = isl_set_align_params(Domain, Parent.getParamSpace());
+  Scattering = isl_map_align_params(Scattering, Parent.getParamSpace());
+}
+
 __isl_give isl_set *ScopStmt::buildConditionSet(const Comparison &Comp) const {
 
   isl_pw_aff *L = SCEVAffinator::getPwAff(this, Comp.getLHS()->OriginalSCEV, 0);
@@ -676,7 +686,6 @@
   Space = isl_space_set_alloc(getIslCtx(), 0, getNumIterators());
 
   Domain = isl_set_universe(Space);
-  Domain = isl_set_align_params(Domain, Parent.getParamSpace());
   Domain = addLoopBoundsToDomain(Domain, tempScop);
   Domain = addConditionsToDomain(Domain, tempScop, CurRegion);
   Domain = isl_set_set_tuple_name(Domain, getBaseName());
@@ -717,7 +726,6 @@
   std::string IterationDomainString = "{[i0] : i0 = 0}";
   Domain = isl_set_read_from_str(getIslCtx(), IterationDomainString.c_str());
   Domain = isl_set_set_tuple_name(Domain, getBaseName());
-  Domain = isl_set_align_params(Domain, parent.getParamSpace());
 
   // Build scattering.
   unsigned ScatSpace = Parent.getMaxLoopDepth() * 2 + 1;
@@ -740,7 +748,6 @@
   bmap = isl_basic_map_add_constraint(bmap, c);
   isl_int_clear(v);
   Scattering = isl_map_from_basic_map(bmap);
-  Scattering = isl_map_align_params(Scattering, parent.getParamSpace());
 
   // Build memory accesses, use SetVector to keep the order of memory accesses
   // and prevent the same memory access inserted more than once.
@@ -875,6 +882,11 @@
   Context = isl_set_universe (Space);
 }
 
+void Scop::realignParams() {
+  for (iterator I = begin(), E = end(); I != E; ++I)
+    (*I)->realignParams();
+}
+
 Scop::Scop(TempScop &tempScop, LoopInfo &LI, ScalarEvolution &ScalarEvolution,
            isl_ctx *Context)
            : SE(&ScalarEvolution), R(tempScop.getMaxRegion()),
@@ -892,6 +904,8 @@
   buildScop(tempScop, getRegion(), NestLoops, Scatter, LI);
   Stmts.push_back(new ScopStmt(*this, Scatter));
 
+  realignParams();
+
   assert(NestLoops.empty() && "NestLoops not empty at top level!");
 }
 





More information about the llvm-commits mailing list