From 19551727e1469ae8bf1cb49e453a7dd3b68d68c2 Mon Sep 17 00:00:00 2001 From: Basile Clement Date: Mon, 3 Jan 2022 14:42:24 +0100 Subject: [PATCH] isl_{set,map}_from_multi_pw_aff: take into account explicit domain When converting a zero-dimensional isl_multi_pw_aff to an isl_set or isl_map, the explicit domain of the isl_multi_pw_aff was not taken into consideration, potentially resulting in a superset of the expected result. Make it so that the resulting set or map is intersected with the explicit domain, if any. Signed-off-by: Basile Clement Signed-off-by: Sven Verdoolaege --- isl_aff_map.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/isl_aff_map.c b/isl_aff_map.c index f661b824..3f46d86b 100644 --- a/isl_aff_map.c +++ b/isl_aff_map.c @@ -427,6 +427,9 @@ __isl_give isl_set *isl_pw_multi_aff_as_set(__isl_take isl_pw_multi_aff *pma) * of the piecewise affine expressions to the range of "mpa" * with each dimension in the range equated to the * corresponding piecewise affine expression. + * + * If "mpa" has an explicit domain (i.e., it is zero-dimensional), + * then return a set or map with the same (parameter) domain. */ static __isl_give isl_map *map_from_multi_pw_aff( __isl_take isl_multi_pw_aff *mpa) @@ -459,6 +462,8 @@ static __isl_give isl_map *map_from_multi_pw_aff( map = isl_map_reset_space(map, isl_multi_pw_aff_get_space(mpa)); + map = isl_map_intersect_multi_pw_aff_explicit_domain(map, mpa); + isl_multi_pw_aff_free(mpa); return map; error: -- 2.11.4.GIT