isl_schedule_get_map: extract schedule from band forest if available
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 20 Mar 2012 16:53:35 +0000 (17:53 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 6 May 2012 12:33:07 +0000 (14:33 +0200)
In the next commits, we will allow the user to modify the band forest.
This means that the schedule represented by the modified band forest
may not be the same as the schedule that was originally computed.
We therefore need to extract it from this forest if the forest
has been constructed already.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_schedule.c

index 7c57156..77ab0b0 100644 (file)
@@ -2862,6 +2862,11 @@ isl_ctx *isl_schedule_get_ctx(__isl_keep isl_schedule *schedule)
        return schedule ? isl_space_get_ctx(schedule->dim) : NULL;
 }
 
+/* Return an isl_union_map of the schedule.  If we have already constructed
+ * a band forest, then this band forest may have been modified so we need
+ * to extract the isl_union_map from the forest rather than from
+ * the originally computed schedule.
+ */
 __isl_give isl_union_map *isl_schedule_get_map(__isl_keep isl_schedule *sched)
 {
        int i;
@@ -2870,6 +2875,9 @@ __isl_give isl_union_map *isl_schedule_get_map(__isl_keep isl_schedule *sched)
        if (!sched)
                return NULL;
 
+       if (sched->band_forest)
+               return isl_band_list_get_suffix_schedule(sched->band_forest);
+
        umap = isl_union_map_empty(isl_space_copy(sched->dim));
        for (i = 0; i < sched->n; ++i) {
                isl_multi_aff *ma;