From: Sven Verdoolaege Date: Wed, 30 May 2012 09:03:12 +0000 (+0200) Subject: isl_space_insert_dims: fix handling of nested spaces X-Git-Tag: isl-0.10~8^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e8234789a0408adb20371db034e810351cda2674;p=platform%2Fupstream%2Fisl.git 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 --- diff --git a/isl_space.c b/isl_space.c index f4b1b2a..87fad1f 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);