[polly] r179268 - ScheduleOptimizer: Use isl_map_from_union_map to extract map.

Tobias Grosser grosser at fim.uni-passau.de
Wed Apr 10 22:55:13 PDT 2013


Author: grosser
Date: Thu Apr 11 00:55:13 2013
New Revision: 179268

URL: http://llvm.org/viewvc/llvm-project?rev=179268&view=rev
Log:
ScheduleOptimizer: Use isl_map_from_union_map to extract map.

Modified:
    polly/trunk/lib/ScheduleOptimizer.cpp

Modified: polly/trunk/lib/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/ScheduleOptimizer.cpp?rev=179268&r1=179267&r2=179268&view=diff
==============================================================================
--- polly/trunk/lib/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/ScheduleOptimizer.cpp Thu Apr 11 00:55:13 2013
@@ -189,13 +189,6 @@ private:
 
 char IslScheduleOptimizer::ID = 0;
 
-static int getSingleMap(__isl_take isl_map *map, void *user) {
-  isl_map **singleMap = (isl_map **)user;
-  *singleMap = map;
-
-  return 0;
-}
-
 void IslScheduleOptimizer::extendScattering(Scop &S, unsigned NewDimensions) {
   for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) {
     ScopStmt *Stmt = *SI;
@@ -533,27 +526,28 @@ bool IslScheduleOptimizer::runOnScop(Sco
 
   for (Scop::iterator SI = S.begin(), SE = S.end(); SI != SE; ++SI) {
     ScopStmt *Stmt = *SI;
+    isl_map *StmtSchedule;
     isl_set *Domain = Stmt->getDomain();
     isl_union_map *StmtBand;
     StmtBand = isl_union_map_intersect_domain(isl_union_map_copy(ScheduleMap),
                                               isl_union_set_from_set(Domain));
-    isl_map *StmtSchedule = NULL;
-    isl_union_map_foreach_map(StmtBand, getSingleMap, &StmtSchedule);
-
-    // Statements with an empty iteration domain may not have a schedule
-    // assigned by the isl schedule optimizer. As Polly expects each statement
-    // to have a schedule, we keep the old schedule for this statement. As
-    // there are zero iterations to execute, the content of the schedule does
-    // not matter.
-    //
-    // TODO: Consider removing such statements when constructing the scop.
-    if (!StmtSchedule) {
+    if (isl_union_map_is_empty(StmtBand)) {
+      // Statements with an empty iteration domain may not have a schedule
+      // assigned by the isl schedule optimizer. As Polly expects each statement
+      // to have a schedule, we keep the old schedule for this statement. As
+      // there are zero iterations to execute, the content of the schedule does
+      // not matter.
+      //
+      // TODO: Consider removing such statements when constructing the scop.
       StmtSchedule = Stmt->getScattering();
       StmtSchedule = isl_map_set_tuple_id(StmtSchedule, isl_dim_out, NULL);
+      isl_union_map_free(StmtBand);
+    } else {
+      assert(isl_union_map_n_map(StmtBand) == 1);
+      StmtSchedule = isl_map_from_union_map(StmtBand);
     }
 
     Stmt->setScattering(StmtSchedule);
-    isl_union_map_free(StmtBand);
   }
 
   isl_union_map_free(ScheduleMap);





More information about the llvm-commits mailing list