[polly] r201886 - Optimizer: Do not accidentally set schedule to NULL

Tobias Grosser tobias at grosser.es
Fri Feb 21 12:51:36 PST 2014


Author: grosser
Date: Fri Feb 21 14:51:36 2014
New Revision: 201886

URL: http://llvm.org/viewvc/llvm-project?rev=201886&view=rev
Log:
Optimizer: Do not accidentally set schedule to NULL

In case the domain of a statement is empty, the schedule optimizer set by
accident the schedule to a NULL pointer. This is incorrect. Instead, we set
it to an empty isl_map with zero schedule dimensions. We already checked for
this in our test cases, but unfortunately the test cases did not fail as
expected. The assert we add in this commit now ensures that the test cases
fail properly in case we regress on this again.

Modified:
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/lib/ScheduleOptimizer.cpp

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=201886&r1=201885&r2=201886&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Fri Feb 21 14:51:36 2014
@@ -500,6 +500,7 @@ void ScopStmt::restrictDomain(__isl_take
 }
 
 void ScopStmt::setScattering(isl_map *NewScattering) {
+  assert(NewScattering && "New scattering is NULL");
   isl_map_free(Scattering);
   Scattering = NewScattering;
 }

Modified: polly/trunk/lib/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/ScheduleOptimizer.cpp?rev=201886&r1=201885&r2=201886&view=diff
==============================================================================
--- polly/trunk/lib/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/ScheduleOptimizer.cpp Fri Feb 21 14:51:36 2014
@@ -544,15 +544,7 @@ bool IslScheduleOptimizer::runOnScop(Sco
     StmtBand = isl_union_map_intersect_domain(isl_union_map_copy(ScheduleMap),
                                               isl_union_set_from_set(Domain));
     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);
+      StmtSchedule = isl_map_from_domain(isl_set_empty(Stmt->getDomainSpace()));
       isl_union_map_free(StmtBand);
     } else {
       assert(isl_union_map_n_map(StmtBand) == 1);





More information about the llvm-commits mailing list