isl_map_gist: return empty set if context is obviously empty
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 28 Oct 2011 12:10:46 +0000 (14:10 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 6 Nov 2011 12:24:47 +0000 (13:24 +0100)
This is more consistent with what happens if the intersection
of input and context turns out to be empty.

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

index 8e70f2d..e568733 100644 (file)
@@ -1768,10 +1768,8 @@ struct isl_basic_map *isl_basic_map_gist(struct isl_basic_map *bmap,
                return bmap;
        }
        if (isl_basic_map_plain_is_empty(context)) {
-               isl_space *dim = isl_space_copy(bmap->dim);
-               isl_basic_map_free(context);
                isl_basic_map_free(bmap);
-               return isl_basic_map_universe(dim);
+               return context;
        }
        if (isl_basic_map_plain_is_empty(bmap)) {
                isl_basic_map_free(context);
@@ -1809,10 +1807,8 @@ __isl_give isl_map *isl_map_gist_basic_map(__isl_take isl_map *map,
                goto error;;
 
        if (isl_basic_map_plain_is_empty(context)) {
-               isl_space *dim = isl_space_copy(map->dim);
-               isl_basic_map_free(context);
                isl_map_free(map);
-               return isl_map_universe(dim);
+               return isl_map_from_basic_map(context);
        }
 
        context = isl_basic_map_remove_redundancies(context);