hide isl_basic_set internals
[platform/upstream/isl.git] / isl_tab_pip.c
index 6fc6459..acf6ead 100644 (file)
@@ -8,9 +8,10 @@
  */
 
 #include "isl_map_private.h"
-#include "isl_seq.h"
+#include <isl/seq.h>
 #include "isl_tab.h"
 #include "isl_sample.h"
+#include <isl_mat_private.h>
 
 /*
  * The implementation of parametric integer linear programming in this file
@@ -1222,8 +1223,6 @@ static struct isl_tab *add_lexmin_valid_eq(struct isl_tab *tab, isl_int *eq)
                if (isl_tab_kill_col(tab, i) < 0)
                        goto error;
                tab->n_eq++;
-
-               tab = restore_lexmin(tab);
        }
 
        return tab;
@@ -1990,6 +1989,8 @@ static struct isl_tab *tab_for_lexmin(struct isl_basic_map *bmap,
                if (!tab || tab->empty)
                        return tab;
        }
+       if (bmap->n_eq)
+               tab = restore_lexmin(tab);
        for (i = 0; i < bmap->n_ineq; ++i) {
                if (max)
                        isl_seq_neg(bmap->ineq[i] + 1 + tab->n_param,
@@ -3895,7 +3896,7 @@ struct isl_map *isl_tab_basic_map_partial_lexopt(
        if (empty)
                *empty = NULL;
        if (!bmap || !dom)
-               goto error;
+               goto error2;
 
        isl_assert(bmap->ctx,
            isl_basic_map_compatible_domain(bmap, dom), goto error);
@@ -3934,6 +3935,8 @@ struct isl_map *isl_tab_basic_map_partial_lexopt(
        sol_free(&sol_map->sol);
        isl_basic_map_free(bmap);
        return result;
+error2:
+       isl_basic_set_free(dom);
 error:
        sol_free(&sol_map->sol);
        isl_basic_map_free(bmap);