bernstein_coefficients_cell: handle NULL poly
[platform/upstream/isl.git] / isl_schedule.c
index a5df67f..320db6c 100644 (file)
@@ -23,6 +23,7 @@
 #include <isl_qsort.h>
 #include <isl_schedule_private.h>
 #include <isl_band_private.h>
+#include <isl_list_private.h>
 
 /*
  * The scheduling algorithm implemented in this file was inspired by
@@ -2272,6 +2273,9 @@ static int compute_schedule_wcc(isl_ctx *ctx, struct isl_sched_graph *graph)
                        return -1;
                if (sol->size == 0) {
                        isl_vec_free(sol);
+                       if (!ctx->opt->schedule_maximize_band_depth &&
+                           graph->n_total_row > graph->band_start)
+                               return compute_next_band(ctx, graph);
                        if (graph->src_scc >= 0)
                                return compute_split_schedule(ctx, graph);
                        if (graph->n_total_row > graph->band_start)
@@ -2459,47 +2463,6 @@ __isl_give isl_union_map *isl_schedule_get_map(__isl_keep isl_schedule *sched)
        return umap;
 }
 
-int isl_schedule_n_band(__isl_keep isl_schedule *sched)
-{
-       return sched ? sched->n_band : 0;
-}
-
-/* Construct a mapping that maps each domain to the band in its schedule
- * with the specified band index.  Note that bands with the same index
- * but for different domains do not need to be related.
- */
-__isl_give isl_union_map *isl_schedule_get_band(__isl_keep isl_schedule *sched,
-       unsigned band)
-{
-       int i;
-       isl_union_map *umap;
-
-       if (!sched)
-               return NULL;
-
-       umap = isl_union_map_empty(isl_dim_copy(sched->dim));
-       for (i = 0; i < sched->n; ++i) {
-               int start, end;
-               isl_map *map;
-
-               if (band >= sched->node[i].n_band)
-                       continue;
-
-               start = band > 0 ? sched->node[i].band_end[band - 1] : 0;
-               end = sched->node[i].band_end[band];
-
-               map = isl_map_copy(sched->node[i].sched);
-
-               map = isl_map_project_out(map, isl_dim_out, end,
-                                         sched->n_total_row - end);
-               map = isl_map_project_out(map, isl_dim_out, 0, start);
-
-               umap = isl_union_map_add_map(umap, map);
-       }
-
-       return umap;
-}
-
 static __isl_give isl_band_list *construct_band_list(
        __isl_keep isl_schedule *schedule, __isl_keep isl_band *parent,
        int band_nr, int *parent_active, int n_active);
@@ -2706,7 +2669,7 @@ __isl_give isl_band_list *isl_schedule_get_band_forest(
                return NULL;
        if (!schedule->band_forest)
                schedule->band_forest = construct_forest(schedule);
-       return isl_band_list_copy(schedule->band_forest);
+       return isl_band_list_dup(schedule->band_forest);
 }
 
 static __isl_give isl_printer *print_band_list(__isl_take isl_printer *p,