From e8234789a0408adb20371db034e810351cda2674 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 30 May 2012 11:03:12 +0200 Subject: [PATCH] isl_space_insert_dims: fix handling of nested spaces In particular, if we are inserting parameters, then we should also insert them in any nested spaces. Signed-off-by: Sven Verdoolaege --- isl_space.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/isl_space.c b/isl_space.c index f4b1b2aa..87fad1f7 100644 --- a/isl_space.c +++ b/isl_space.c @@ -795,6 +795,10 @@ static int valid_dim_type(enum isl_dim_type type) } } +/* Insert "n" dimensions of type "type" at position "pos". + * If we are inserting parameters, then they are also inserted in + * any nested spaces. + */ __isl_give isl_space *isl_space_insert_dims(__isl_take isl_space *dim, enum isl_dim_type type, unsigned pos, unsigned n) { @@ -852,6 +856,17 @@ __isl_give isl_space *isl_space_insert_dims(__isl_take isl_space *dim, } dim = isl_space_reset(dim, type); + if (type == isl_dim_param) { + if (dim && dim->nested[0] && + !(dim->nested[0] = isl_space_insert_dims(dim->nested[0], + isl_dim_param, pos, n))) + goto error; + if (dim && dim->nested[1] && + !(dim->nested[1] = isl_space_insert_dims(dim->nested[1], + isl_dim_param, pos, n))) + goto error; + } + return dim; error: isl_space_free(dim); -- 2.11.4.GIT