isl_map_transitive_closure: break early if input map doesn't compose with itself
[platform/upstream/isl.git] / isl_map_simplify.c
index e17dffb..d4b7af9 100644 (file)
@@ -1,3 +1,12 @@
+/*
+ * Copyright 2008-2009 Katholieke Universiteit Leuven
+ *
+ * Use of this software is governed by the GNU LGPLv2.1 license
+ *
+ * Written by Sven Verdoolaege, K.U.Leuven, Departement
+ * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
+ */
+
 #include "isl_equalities.h"
 #include "isl_map.h"
 #include "isl_map_private.h"
@@ -233,6 +242,12 @@ error:
        return NULL;
 }
 
+struct isl_set *isl_set_drop(struct isl_set *set,
+       enum isl_dim_type type, unsigned first, unsigned n)
+{
+       return (isl_set *)isl_map_drop((isl_map *)set, type, first, n);
+}
+
 struct isl_map *isl_map_drop_inputs(
                struct isl_map *map, unsigned first, unsigned n)
 {
@@ -1567,9 +1582,10 @@ static struct isl_basic_set *uset_gist(struct isl_basic_set *bset,
        bset = remove_shifted_constraints(bset, context);
        if (!bset->n_ineq)
                goto done;
-       isl_basic_set_free_equality(context, context->n_eq);
        context_ineq = context->n_ineq;
        combined = isl_basic_set_cow(isl_basic_set_copy(context));
+       if (isl_basic_set_free_equality(combined, context->n_eq) < 0)
+               goto error;
        combined = isl_basic_set_extend_constraints(combined,
                                                    bset->n_eq, bset->n_ineq);
        tab = isl_tab_from_basic_set(combined);
@@ -1586,9 +1602,10 @@ static struct isl_basic_set *uset_gist(struct isl_basic_set *bset,
                        goto error;
        bset = isl_basic_set_add_constraints(combined, bset, 0);
        tab = isl_tab_detect_implicit_equalities(tab);
-       tab = isl_tab_detect_redundant(tab);
-       if (!tab)
+       if (isl_tab_detect_redundant(tab) < 0) {
+               isl_tab_free(tab);
                goto error2;
+       }
        for (i = 0; i < context_ineq; ++i) {
                tab->con[i].is_zero = 0;
                tab->con[i].is_redundant = 1;