From 3fe4714635e4940859d2fdb54a66546be278a1a8 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 19 Feb 2011 18:35:24 +0100 Subject: [PATCH] isl_map_coalesce: be more relaxed about multiple equalities being adjacent We try to avoid wrapping in a basic map that has multiple equalities that are adjacent to inequalities in the other basic map, because that may lead to more complicated constraints. The original check would, however, also prevent the extension of one basic map with an other if they happened to lie in a shared affine subspace. By moving the test for multiple equalities after the check for extensions, we allow such extensions, while still preventing undesired wrapping. We can probably do better by explicitly detecting and exploiting the shared affine subspace. Signed-off-by: Sven Verdoolaege --- isl_coalesce.c | 6 ++++-- isl_test.c | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/isl_coalesce.c b/isl_coalesce.c index 22524aa7..a07d983a 100644 --- a/isl_coalesce.c +++ b/isl_coalesce.c @@ -916,8 +916,7 @@ static int check_adj_eq(struct isl_map *map, int i, int j, if (any(ineq_i, map->p[i]->n_ineq, STATUS_CUT)) /* ADJ EQ CUT */ return 0; - if (count(eq_j, 2 * map->p[j]->n_eq, STATUS_ADJ_INEQ) != 1 || - count(ineq_i, map->p[i]->n_ineq, STATUS_ADJ_EQ) != 1 || + if (count(ineq_i, map->p[i]->n_ineq, STATUS_ADJ_EQ) != 1 || any(ineq_j, map->p[j]->n_ineq, STATUS_ADJ_EQ) || any(ineq_i, map->p[i]->n_ineq, STATUS_ADJ_INEQ) || any(ineq_j, map->p[j]->n_ineq, STATUS_ADJ_INEQ)) @@ -932,6 +931,9 @@ static int check_adj_eq(struct isl_map *map, int i, int j, if (changed) return changed; + if (count(eq_j, 2 * map->p[j]->n_eq, STATUS_ADJ_INEQ) != 1) + return 0; + changed = can_wrap_in_facet(map, i, j, k, tabs, eq_i, ineq_i, eq_j, ineq_j); return changed; diff --git a/isl_test.c b/isl_test.c index 2f197996..6116e3ac 100644 --- a/isl_test.c +++ b/isl_test.c @@ -906,6 +906,8 @@ void test_coalesce(struct isl_ctx *ctx) test_coalesce_set(ctx, "{[x,0,0] : -5 <= x <= 5; [0,y,1] : -5 <= y <= 5 }", 1); test_coalesce_set(ctx, "{ [x, 1 - x] : 0 <= x <= 1; [0,0] }", 1); + test_coalesce_set(ctx, "{ [0,0]; [i,i] : 1 <= i <= 10 }", 1); + test_coalesce_set(ctx, "{ [0,0]; [i,j] : 1 <= i,j <= 10 }", 0); } void test_closure(struct isl_ctx *ctx) -- 2.11.4.GIT