summaryrefslogtreecommitdiffstats
path: root/polly/lib/ScheduleOptimizer.cpp
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2013-04-10 22:48:08 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2013-04-10 22:48:08 +0000
commitf242b806ac8bc61b9fcdf26ae2dcb57dae52a616 (patch)
tree154f95c1d57929e7008777a6669503d8fcf6341b /polly/lib/ScheduleOptimizer.cpp
parent8fc29db312282fb6f025ad2042ad60cd727d288d (diff)
downloadbcm5719-llvm-f242b806ac8bc61b9fcdf26ae2dcb57dae52a616.tar.gz
bcm5719-llvm-f242b806ac8bc61b9fcdf26ae2dcb57dae52a616.zip
ScheduleOpt: Do not crash on statements with empty iteration domains
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 such statements. This fixes http://llvm.org/PR15645` Reported-by: Johannes Doerfert <johannesdoerfert@gmx.de> llvm-svn: 179233
Diffstat (limited to 'polly/lib/ScheduleOptimizer.cpp')
-rw-r--r--polly/lib/ScheduleOptimizer.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/polly/lib/ScheduleOptimizer.cpp b/polly/lib/ScheduleOptimizer.cpp
index 10639771765..e37b759784a 100644
--- a/polly/lib/ScheduleOptimizer.cpp
+++ b/polly/lib/ScheduleOptimizer.cpp
@@ -537,8 +537,21 @@ bool IslScheduleOptimizer::runOnScop(Scop &S) {
isl_union_map *StmtBand;
StmtBand = isl_union_map_intersect_domain(isl_union_map_copy(ScheduleMap),
isl_union_set_from_set(Domain));
- isl_map *StmtSchedule;
+ 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) {
+ StmtSchedule = Stmt->getScattering();
+ StmtSchedule = isl_map_set_tuple_id(StmtSchedule, isl_dim_out, NULL);
+ }
+
Stmt->setScattering(StmtSchedule);
isl_union_map_free(StmtBand);
}
OpenPOWER on IntegriCloud