isl_basic_map_remove_divs_involving_dims: handle disappearance of divs
authorSven Verdoolaege <skimo@kotnet.org>
Sat, 18 Jun 2011 07:56:15 +0000 (09:56 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 18 Jun 2011 12:09:09 +0000 (14:09 +0200)
The internal call to isl_basic_map_remove_dims may remove more divs
than explicitly asked for (or it may reorder them) because it involves
a simplification step.  We therefore have to reconsider all the divs
after calling isl_basic_map_remove_dims.

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

index 334f383..d4a9a49 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -1548,6 +1548,9 @@ __isl_give isl_basic_map *isl_basic_map_remove_divs_involving_dims(
                if (!div_involves_vars(bmap, i, first, n))
                        continue;
                bmap = isl_basic_map_remove_dims(bmap, isl_dim_div, i, 1);
+               if (!bmap)
+                       return NULL;
+               i = bmap->n_div;
        }
 
        return bmap;