isl_tab.c: store number of equalities among the constraints in tableau
authorSven Verdoolaege <skimo@kotnet.org>
Mon, 23 Mar 2009 08:21:22 +0000 (09:21 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Mon, 23 Mar 2009 09:00:20 +0000 (10:00 +0100)
Before, we would check the bmap to figure out how many equalities we
had added, but there was at least one instance where we didn't actually
store the equalities in the tableau, leading to problems if any additional
equalities would be found in the tableau.

isl_map_simplify.c
isl_tab.c
isl_tab.h

index f37cb2a..bb48508 100644 (file)
@@ -1398,7 +1398,7 @@ static struct isl_basic_set *uset_gist(struct isl_basic_set *bset,
 {
        int i;
        struct isl_tab *tab;
-       unsigned context_ineq, bset_eq;
+       unsigned context_ineq;
        struct isl_basic_set *combined = NULL;
 
        if (!context || !bset)
@@ -1456,10 +1456,7 @@ static struct isl_basic_set *uset_gist(struct isl_basic_set *bset,
                tab->con[i].is_zero = 0;
                tab->con[i].is_redundant = 1;
        }
-       bset_eq = bset->n_eq;
-       bset->n_eq = 0;
        bset = isl_basic_set_update_from_tab(bset, tab);
-       bset->n_eq = bset_eq;
        isl_tab_free(bset->ctx, tab);
        ISL_F_SET(bset, ISL_BASIC_SET_NO_IMPLICIT);
        ISL_F_SET(bset, ISL_BASIC_SET_NO_REDUNDANT);
index b3e5618..7aeac66 100644 (file)
--- a/isl_tab.c
+++ b/isl_tab.c
@@ -42,6 +42,7 @@ struct isl_tab *isl_tab_alloc(struct isl_ctx *ctx,
        }
        tab->n_row = 0;
        tab->n_con = 0;
+       tab->n_eq = 0;
        tab->max_con = n_row;
        tab->n_col = n_var;
        tab->n_var = n_var;
@@ -944,6 +945,7 @@ static struct isl_tab *add_eq(struct isl_ctx *ctx,
                kill_col(ctx, tab, i);
                break;
        }
+       tab->n_eq++;
 
        return tab;
 error:
@@ -1117,7 +1119,7 @@ struct isl_basic_map *isl_basic_map_update_from_tab(struct isl_basic_map *bmap,
        if (!tab)
                return bmap;
 
-       n_eq = bmap->n_eq;
+       n_eq = tab->n_eq;
        if (tab->empty)
                bmap = isl_basic_map_set_to_empty(bmap);
        else
index b4ab068..e3535f7 100644 (file)
--- a/isl_tab.h
+++ b/isl_tab.h
@@ -78,6 +78,7 @@ struct isl_tab {
 
        unsigned n_var;
        unsigned n_con;
+       unsigned n_eq;
        unsigned max_con;
        struct isl_tab_var *var;
        struct isl_tab_var *con;