From a9cf3b326229daa2c1402c4adcee09331c442233 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 11 Mar 2014 12:32:27 +0100 Subject: [PATCH] tree2scop.c: after: handle higher dimensional domains Currently, the input set of after is always single-dimensional. However, when we change the extraction of a pet_scop from a pet_tree from a bottom-up process to a top-down process, the dimension of this set will be equal to the number of outer loops, including the current loop. We therefore need to take into account that the dimension of the input may be greater than 1. Signed-off-by: Sven Verdoolaege --- tree2scop.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tree2scop.c b/tree2scop.c index a022f98..f887fd0 100644 --- a/tree2scop.c +++ b/tree2scop.c @@ -198,16 +198,26 @@ static __isl_give isl_set *embed(__isl_take isl_set *set, } /* Return those elements in the space of "cond" that come after - * (based on "sign") an element in "cond". + * (based on "sign") an element in "cond" in the final dimension. */ static __isl_give isl_set *after(__isl_take isl_set *cond, int sign) { + isl_space *space; isl_map *previous_to_this; - + int i, dim; + + dim = isl_set_dim(cond, isl_dim_set); + space = isl_space_map_from_set(isl_set_get_space(cond)); + previous_to_this = isl_map_universe(space); + for (i = 0; i + 1 < dim; ++i) + previous_to_this = isl_map_equate(previous_to_this, + isl_dim_in, i, isl_dim_out, i); if (sign > 0) - previous_to_this = isl_map_lex_lt(isl_set_get_space(cond)); + previous_to_this = isl_map_order_lt(previous_to_this, + isl_dim_in, dim - 1, isl_dim_out, dim - 1); else - previous_to_this = isl_map_lex_gt(isl_set_get_space(cond)); + previous_to_this = isl_map_order_gt(previous_to_this, + isl_dim_in, dim - 1, isl_dim_out, dim - 1); cond = isl_set_apply(cond, previous_to_this); -- 2.11.4.GIT