isl_basic_map_is_empty: special case known empty basic sets
authorSven Verdoolaege <skimo@kotnet.org>
Sat, 9 Aug 2008 12:14:12 +0000 (14:14 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Mon, 25 Aug 2008 07:24:18 +0000 (09:24 +0200)
include/isl_map.h
include/isl_set.h
isl_map.c

index 0ce4df2..8af220c 100644 (file)
@@ -36,6 +36,7 @@ extern "C" {
 struct isl_basic_map {
        int ref;
 #define ISL_BASIC_MAP_FINAL            (1 << 0)
+#define ISL_BASIC_MAP_EMPTY            (1 << 1)
        unsigned flags;
 
        unsigned nparam;
index 2bdc27a..b45a301 100644 (file)
@@ -13,6 +13,7 @@ extern "C" {
 struct isl_basic_set {
        int ref;
 #define ISL_BASIC_SET_FINAL            (1 << 0)
+#define ISL_BASIC_SET_EMPTY            (1 << 1)
        unsigned flags;
 
        unsigned nparam;
index 97621bd..99045af 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -662,6 +662,7 @@ struct isl_basic_map *isl_basic_map_set_to_empty(
        }
        isl_int_set_si(bmap->eq[i][0], 1);
        isl_seq_clr(bmap->eq[i]+1, total);
+       F_SET(bmap, ISL_BASIC_MAP_EMPTY);
        return isl_basic_map_finalize(ctx, bmap);
 error:
        isl_basic_map_free(ctx, bmap);
@@ -2484,6 +2485,9 @@ int isl_basic_map_is_empty(struct isl_ctx *ctx,
        if (!bmap)
                return -1;
 
+       if (F_ISSET(bmap, ISL_BASIC_MAP_EMPTY))
+               return 1;
+
        bset = isl_basic_set_from_basic_map(ctx,
                        isl_basic_map_copy(ctx, bmap));
        if (!bset)