From ae50237b86f23c232dd5d99d3e420fa0e775ce01 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 31 Jan 2012 12:27:09 +0100 Subject: [PATCH] isl_space_set_dim_id: also set id of parameter in nested spaces A nested space is supposed to have the same parameters as the nesting space, so if the id of a parameter in the nesting space space changes, it has to be changed in the nested spaces too. Signed-off-by: Sven Verdoolaege --- isl_space.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/isl_space.c b/isl_space.c index f5299be..48f6385 100644 --- a/isl_space.c +++ b/isl_space.c @@ -434,12 +434,32 @@ error: return NULL; } +/* Set the id of the given dimension of "space" to "id". + * If the dimension already has an id, then it is replaced. + * If the dimension is a parameter, then we need to change it + * in the nested spaces (if any) as well. + */ __isl_give isl_space *isl_space_set_dim_id(__isl_take isl_space *space, enum isl_dim_type type, unsigned pos, __isl_take isl_id *id) { space = isl_space_cow(space); if (!space || !id) goto error; + + if (type == isl_dim_param) { + int i; + + for (i = 0; i < 2; ++i) { + if (!space->nested[i]) + continue; + space->nested[i] = + isl_space_set_dim_id(space->nested[i], + type, pos, isl_id_copy(id)); + if (!space->nested[i]) + goto error; + } + } + isl_id_free(get_id(space, type, pos)); return set_id(space, type, pos, id); error: -- 2.7.4