isl_basic_map_eliminate_vars: remove all redundant constraints after each step
authorSven Verdoolaege <skimo@kotnet.org>
Mon, 22 Sep 2008 22:00:46 +0000 (00:00 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 12 Oct 2008 10:11:32 +0000 (12:11 +0200)
include/isl_map.h
isl_map.c

index 00fbeee..3196a93 100644 (file)
@@ -113,6 +113,7 @@ struct isl_basic_map *isl_basic_map_empty(struct isl_ctx *ctx,
                unsigned nparam, unsigned in, unsigned out);
 struct isl_basic_map *isl_basic_map_universe(struct isl_ctx *ctx,
                unsigned nparam, unsigned in, unsigned out);
+struct isl_basic_map *isl_basic_map_convex_hull(struct isl_basic_map *bmap);
 
 struct isl_basic_map *isl_basic_map_intersect_domain(
                struct isl_basic_map *bmap,
index 666cb10..94d490f 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -955,7 +955,8 @@ static struct isl_basic_map *remove_duplicate_constraints(
                        index[h] = k+1;
                        continue;
                }
-               *progress = 1;
+               if (progress)
+                       *progress = 1;
                l = index[h] - 1;
                if (isl_int_lt(bmap->ineq[k][0], bmap->ineq[l][0]))
                        swap_inequality(bmap, k, l);
@@ -1204,7 +1205,11 @@ struct isl_basic_map *isl_basic_map_eliminate_vars(
                }
                if (n_lower > 0 && n_upper > 0) {
                        bmap = normalize_constraints(bmap);
+                       bmap = remove_duplicate_constraints(bmap, NULL);
                        bmap = isl_basic_map_gauss(bmap, NULL);
+                       bmap = isl_basic_map_convex_hull(bmap);
+                       if (!bmap)
+                               goto error;
                        if (F_ISSET(bmap, ISL_BASIC_MAP_EMPTY))
                                break;
                }