isl_schedule.c: sort_band_list: take into account that parent may be NULL
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 9 Apr 2013 15:37:46 +0000 (17:37 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 9 Apr 2013 15:59:53 +0000 (17:59 +0200)
We missed this in 81bf4c2 (isl_schedule_get_band_forest: sort bands
in band list, Tue Feb 26 12:35:16 2013 +0100).

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

index 9e6e617..d1f8e66 100644 (file)
@@ -3279,7 +3279,8 @@ static int cmp_band(const void *a, const void *b, void *user)
  *
  * If there is only one element in the list, then there is no need to sort
  * anything.
- * If partial schedule of the parent has more than one member, then it's
+ * If the partial schedule of the parent has more than one member
+ * (or if there is no parent), then it's
  * defnitely not assigning constant values to the different children in
  * the list and so we wouldn't be able to use it to sort the list.
  */
@@ -3292,7 +3293,7 @@ static __isl_give isl_band_list *sort_band_list(__isl_take isl_band_list *list,
                return NULL;
        if (list->n <= 1)
                return list;
-       if (parent->n != 1)
+       if (!parent || parent->n != 1)
                return list;
 
        data.r = 0;