isl_basic_map_dup: copy flags of original to duplicate
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 10 Mar 2009 12:29:41 +0000 (13:29 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Fri, 20 Mar 2009 14:21:06 +0000 (15:21 +0100)
Before, the copied flags would get removed by the subsequent dup_constraints.
Some other code depended on isl_basic_map_cow clearing all flags and
failed to clear some flags.

include/isl_set.h
isl_map.c
isl_mat.c

index 1f77b1c..6733e63 100644 (file)
@@ -15,7 +15,12 @@ struct isl_basic_set {
        int ref;
 #define ISL_BASIC_SET_FINAL            (1 << 0)
 #define ISL_BASIC_SET_EMPTY            (1 << 1)
+#define ISL_BASIC_SET_NO_IMPLICIT      (1 << 2)
+#define ISL_BASIC_SET_NO_REDUNDANT     (1 << 3)
+#define ISL_BASIC_SET_RATIONAL         (1 << 4)
 #define ISL_BASIC_SET_NORMALIZED       (1 << 5)
+#define ISL_BASIC_SET_NORMALIZED_DIVS  (1 << 6)
+#define ISL_BASIC_SET_ALL_EQUALITIES   (1 << 7)
        unsigned flags;
 
        struct isl_ctx *ctx;
index a5fdbd1..58544c1 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -372,8 +372,8 @@ struct isl_basic_map *isl_basic_map_dup(struct isl_basic_map *bmap)
                        bmap->n_div, bmap->n_eq, bmap->n_ineq);
        if (!dup)
                return NULL;
-       dup->flags = bmap->flags;
        dup_constraints(dup, bmap);
+       dup->flags = bmap->flags;
        dup->sample = isl_vec_copy(bmap->ctx, bmap->sample);
        return dup;
 }
@@ -465,6 +465,10 @@ int isl_basic_map_alloc_equality(struct isl_basic_map *bmap)
        isl_assert(ctx, room_for_con(bmap, 1), return -1);
        isl_assert(ctx, (bmap->eq - bmap->ineq) + bmap->n_eq <= bmap->c_size,
                        return -1);
+       ISL_F_CLR(bmap, ISL_BASIC_MAP_NORMALIZED);
+       ISL_F_CLR(bmap, ISL_BASIC_MAP_NO_REDUNDANT);
+       ISL_F_CLR(bmap, ISL_BASIC_MAP_NO_IMPLICIT);
+       ISL_F_CLR(bmap, ISL_BASIC_MAP_ALL_EQUALITIES);
        ISL_F_CLR(bmap, ISL_BASIC_MAP_NORMALIZED_DIVS);
        if ((bmap->eq - bmap->ineq) + bmap->n_eq == bmap->c_size) {
                isl_int *t;
@@ -532,6 +536,7 @@ void isl_basic_map_inequality_to_equality(
        bmap->n_eq++;
        bmap->n_ineq--;
        bmap->eq--;
+       ISL_F_CLR(bmap, ISL_BASIC_MAP_NO_REDUNDANT);
        ISL_F_CLR(bmap, ISL_BASIC_MAP_NORMALIZED);
        ISL_F_CLR(bmap, ISL_BASIC_MAP_NORMALIZED_DIVS);
        ISL_F_CLR(bmap, ISL_BASIC_MAP_ALL_EQUALITIES);
index e15967f..00ac607 100644 (file)
--- a/isl_mat.c
+++ b/isl_mat.c
@@ -844,6 +844,12 @@ struct isl_basic_set *isl_basic_set_preimage(struct isl_basic_set *bset,
        }
        isl_mat_free(ctx, t);
 
+       ISL_F_CLR(bset, ISL_BASIC_SET_NO_IMPLICIT);
+       ISL_F_CLR(bset, ISL_BASIC_SET_NO_REDUNDANT);
+       ISL_F_CLR(bset, ISL_BASIC_SET_NORMALIZED);
+       ISL_F_CLR(bset, ISL_BASIC_SET_NORMALIZED_DIVS);
+       ISL_F_CLR(bset, ISL_BASIC_SET_ALL_EQUALITIES);
+
        bset = isl_basic_set_simplify(bset);
        bset = isl_basic_set_finalize(bset);