From 950d2defe302f3f1857831676310a4355708170d Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 22 Jul 2014 11:10:56 +0200 Subject: [PATCH] isl_ast_build.c: update_values: explicitly take into account stride constraint Before this commit we would rely on the caller to add the stride constraint to the build domain. However, we want to avoid adding this stride constraint to the build domain in some cases and so we have to take it into account explicitly while checking if the dimension attains a single value. Signed-off-by: Sven Verdoolaege --- isl_ast_build.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/isl_ast_build.c b/isl_ast_build.c index de44e5bd..521ddde1 100644 --- a/isl_ast_build.c +++ b/isl_ast_build.c @@ -628,7 +628,24 @@ static int extract_single_piece(__isl_take isl_set *set, return -1; } -/* Check if the given bounds on the current dimension imply that +/* Intersect "set" with the stride constraint of "build", if any. + */ +static __isl_give isl_set *intersect_stride_constraint(__isl_take isl_set *set, + __isl_keep isl_ast_build *build) +{ + isl_set *stride; + + if (!build) + return isl_set_free(set); + if (!isl_ast_build_has_stride(build, build->depth)) + return set; + + stride = isl_ast_build_get_stride_constraint(build); + return isl_set_intersect(set, stride); +} + +/* Check if the given bounds on the current dimension (together with + * the stride constraint, if any) imply that * this current dimension attains only a single value (in terms of * parameters and outer dimensions). * If so, we record it in build->value. @@ -655,6 +672,7 @@ static __isl_give isl_ast_build *update_values( set = isl_set_from_basic_set(bounds); set = isl_set_intersect(set, isl_set_copy(build->domain)); + set = intersect_stride_constraint(set, build); it_map = isl_ast_build_map_to_iterator(build, set); sv = isl_map_is_single_valued(it_map); -- 2.11.4.GIT