isl_map_simplify.c: remove_duplicate_divs: preserve known divs
authorSven Verdoolaege <skimo@kotnet.org>
Thu, 6 Sep 2012 12:35:55 +0000 (14:35 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Thu, 6 Sep 2012 12:35:55 +0000 (14:35 +0200)
As explained in the commit message of 22c210c (isl_basic_map_gauss:
try not to remove any div definitions, Tue Sep 1 22:59:21 2009 +0200),
we should preserve known divs during isl_basic_map_simplify.
That commit only fixed the possible loss of known divs in
isl_basic_map_gauss.  Here we fix the same problem in remove_duplicate_divs.

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

index c209867..9897d80 100644 (file)
@@ -715,6 +715,7 @@ static struct isl_basic_map *remove_duplicate_divs(
        unsigned total;
        struct isl_ctx *ctx;
 
+       bmap = isl_basic_map_order_divs(bmap);
        if (!bmap || bmap->n_div <= 1)
                return bmap;
 
@@ -764,7 +765,7 @@ static struct isl_basic_map *remove_duplicate_divs(
                k = elim_for[l] - 1;
                isl_int_set_si(eq.data[1+total_var+k], -1);
                isl_int_set_si(eq.data[1+total_var+l], 1);
-               eliminate_div(bmap, eq.data, l, 0);
+               eliminate_div(bmap, eq.data, l, 1);
                isl_int_set_si(eq.data[1+total_var+k], 0);
                isl_int_set_si(eq.data[1+total_var+l], 0);
        }