isl_basic_map_insert: preserve emptiness
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 17 Apr 2012 10:50:27 +0000 (12:50 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 17 Apr 2012 19:11:06 +0000 (21:11 +0200)
isl_basic_map_plain_is_empty doesn't look at the constraints but only
at the ISL_BASIC_MAP_EMPTY flag.  We therefore need to make sure the
flag is set on the output of isl_basic_map_insert if it was set on the
input.

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

index e0defa7..8c205b0 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -2696,6 +2696,10 @@ __isl_give isl_basic_map *isl_basic_map_insert(__isl_take isl_basic_map *bmap,
                        bmap->n_div, bmap->n_eq, bmap->n_ineq);
        if (isl_basic_map_is_rational(bmap))
                res = isl_basic_map_set_rational(res);
+       if (isl_basic_map_plain_is_empty(bmap)) {
+               isl_basic_map_free(bmap);
+               return isl_basic_map_set_to_empty(res);
+       }
        res = isl_basic_map_add_constraints_dim_map(res, bmap, dim_map);
        return isl_basic_map_finalize(res);
 }