isl_basic_map_involves_dims: double-check divs
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 29 Nov 2011 09:17:46 +0000 (10:17 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Wed, 30 Nov 2011 09:37:23 +0000 (10:37 +0100)
In principle, the extra test is not needed at this moment, but
this may change in future.

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

index 86b50d2..cbac878 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -1753,6 +1753,12 @@ __isl_give isl_set *isl_set_remove_divs_involving_dims(__isl_take isl_set *set,
                                                              type, first, n);
 }
 
+/* Does the desciption of "bmap" depend on the specified dimensions?
+ * We also check whether the dimensions appear in any of the div definitions.
+ * In principle there is no need for this check.  If the dimensions appear
+ * in a div definition, they also appear in the defining constraints of that
+ * div.
+ */
 int isl_basic_map_involves_dims(__isl_keep isl_basic_map *bmap,
        enum isl_dim_type type, unsigned first, unsigned n)
 {
@@ -1772,6 +1778,12 @@ int isl_basic_map_involves_dims(__isl_keep isl_basic_map *bmap,
        for (i = 0; i < bmap->n_ineq; ++i)
                if (isl_seq_first_non_zero(bmap->ineq[i] + first, n) >= 0)
                        return 1;
+       for (i = 0; i < bmap->n_div; ++i) {
+               if (isl_int_is_zero(bmap->div[i][0]))
+                       continue;
+               if (isl_seq_first_non_zero(bmap->div[i] + 1 + first, n) >= 0)
+                       return 1;
+       }
 
        return 0;
 }