From e8ad97432e2dfd7500e7f35c5949d316b2aa0fff Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 5 May 2015 15:34:04 +0200 Subject: [PATCH] isl_basic_map_reduce_coefficients: call gauss when equalities have been found Many parts of the code assume that Gaussian elimination has been applied to the equalities. In particular, isl_tab_from_basic_map, which is called right after isl_basic_map_reduce_coefficients in isl_map_coalesce, makes this assumption. When isl_basic_map_reduce_coefficients detects extra equalities, it should therefore call isl_basic_map_gauss. Signed-off-by: Sven Verdoolaege --- isl_map_simplify.c | 6 ++++-- isl_test.c | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/isl_map_simplify.c b/isl_map_simplify.c index 6dfcf609..8ad4304f 100644 --- a/isl_map_simplify.c +++ b/isl_map_simplify.c @@ -3404,7 +3404,7 @@ static __isl_give isl_vec *normalize_constraint(__isl_take isl_vec *v, * opposite inequalities that can be replaced by an equality. * We therefore call isl_basic_map_detect_inequality_pairs, * which checks for such pairs of inequalities as well as eliminate_divs_eq - * if such a pair was found. + * and isl_basic_map_gauss if such a pair was found. */ __isl_give isl_basic_map *isl_basic_map_reduce_coefficients( __isl_take isl_basic_map *bmap) @@ -3465,8 +3465,10 @@ __isl_give isl_basic_map *isl_basic_map_reduce_coefficients( int progress = 0; bmap = isl_basic_map_detect_inequality_pairs(bmap, &progress); - if (progress) + if (progress) { bmap = eliminate_divs_eq(bmap, &progress); + bmap = isl_basic_map_gauss(bmap, NULL); + } } return bmap; diff --git a/isl_test.c b/isl_test.c index b972d326..81b4a3f8 100644 --- a/isl_test.c +++ b/isl_test.c @@ -1588,6 +1588,14 @@ struct { "n <= 2147483647 and t0 <= 31 and t0 >= 0 and i0 >= 11 and " "i0 >= 96 - 3t0 and i0 <= 95 + n - 3t0 and i0 <= 7 + n and " "i8 >= -40 + i0 and i8 <= -10 + i0)) }" }, + { 0, "{ [i0, i1, i2] : " + "(exists (e0, e1 = floor((i0)/32), e2 = floor((i1)/32): " + "32e1 = i0 and 32e2 = i1 and i1 >= -31 + i0 and " + "i1 <= 31 + i0 and i2 >= -30 + i0 and i2 >= -30 + i1 and " + "32e0 >= -30 + i0 and 32e0 >= -30 + i1 and " + "32e0 >= -31 + i2 and 32e0 <= 30 + i2 and 32e0 <= 31 + i1 and " + "32e0 <= 31 + i0)) or " + "i0 >= 0 }" }, }; /* A specialized coalescing test case that would result -- 2.11.4.GIT