isl_basic_map_realign: preserve (most) flags
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 14 Feb 2012 19:02:43 +0000 (20:02 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 14 Feb 2012 23:20:05 +0000 (00:20 +0100)
In particular, preserve the ISL_BASIC_MAP_EMPTY flag.
Many parts of the code check for this flags so they do not have
to deal with the "1 = 0" constraint.

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

index 41d5d49..240457a 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -9333,14 +9333,21 @@ __isl_give isl_basic_map *isl_basic_map_realign(__isl_take isl_basic_map *bmap,
        __isl_take isl_space *dim, __isl_take struct isl_dim_map *dim_map)
 {
        isl_basic_map *res;
+       unsigned flags;
 
        bmap = isl_basic_map_cow(bmap);
        if (!bmap || !dim || !dim_map)
                goto error;
 
+       flags = bmap->flags;
+       ISL_FL_CLR(flags, ISL_BASIC_MAP_FINAL);
+       ISL_FL_CLR(flags, ISL_BASIC_MAP_NORMALIZED);
+       ISL_FL_CLR(flags, ISL_BASIC_MAP_NORMALIZED_DIVS);
        res = isl_basic_map_alloc_space(dim,
                        bmap->n_div, bmap->n_eq, bmap->n_ineq);
        res = isl_basic_map_add_constraints_dim_map(res, bmap, dim_map);
+       if (res)
+               res->flags = flags;
        res = isl_basic_map_finalize(res);
        return res;
 error: