X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=isl_local_space.c;h=42f3e9ffcf648c89073be499307a66da4aaf0b02;hb=9d324d06a55e275f4a33a76af5218d96bb3fc8f2;hp=33bf348fb6b7abe8577b73b8058ecb2514124218;hpb=7a2c71ccb84377c8066ba59c9ec3fc20a5b8349e;p=platform%2Fupstream%2Fisl.git diff --git a/isl_local_space.c b/isl_local_space.c index 33bf348..42f3e9f 100644 --- a/isl_local_space.c +++ b/isl_local_space.c @@ -219,6 +219,9 @@ __isl_give isl_aff *isl_local_space_get_div(__isl_keep isl_local_space *ls, if (isl_int_is_zero(ls->div->row[pos][0])) isl_die(isl_local_space_get_ctx(ls), isl_error_invalid, "expression of div unknown", return NULL); + if (!isl_local_space_is_set(ls)) + isl_die(isl_local_space_get_ctx(ls), isl_error_invalid, + "cannot represent divs of map spaces", return NULL); aff = isl_aff_alloc(isl_local_space_copy(ls)); if (!aff) @@ -752,7 +755,7 @@ error: /* Plug in the affine expressions "subs" of length "subs_len" (including * the denominator and the constant term) into the variable at position "pos" - * of all the div expressions starting at "first". + * of the "n" div expressions starting at "first". * * Let i be the dimension to replace and let "subs" be of the form * @@ -769,11 +772,13 @@ error: __isl_give isl_local_space *isl_local_space_substitute_seq( __isl_take isl_local_space *ls, enum isl_dim_type type, unsigned pos, isl_int *subs, int subs_len, - int first) + int first, int n) { int i; isl_int v; + if (n == 0) + return ls; ls = isl_local_space_cow(ls); if (!ls) return NULL; @@ -781,6 +786,10 @@ __isl_give isl_local_space *isl_local_space_substitute_seq( if (!ls->div) return isl_local_space_free(ls); + if (first + n > ls->div->n_row) + isl_die(isl_local_space_get_ctx(ls), isl_error_invalid, + "index out of bounds", return isl_local_space_free(ls)); + pos += isl_local_space_offset(ls, type); isl_int_init(v); @@ -828,7 +837,7 @@ __isl_give isl_local_space *isl_local_space_substitute( return isl_local_space_free(ls)); return isl_local_space_substitute_seq(ls, type, pos, subs->v->el, - subs->v->size, 0); + subs->v->size, 0, ls->div->n_row); } int isl_local_space_is_named_or_nested(__isl_keep isl_local_space *ls, @@ -1098,7 +1107,7 @@ __isl_give isl_local_space *isl_local_space_preimage_multi_aff( continue; } isl_seq_preimage(res->div->row[n_div_ma + i], ls->div->row[i], - ma, n_div_ma, n_div_ls, f, c1, c2, g, 1); + ma, 0, 0, n_div_ma, n_div_ls, f, c1, c2, g, 1); normalize_div(res, n_div_ma + i); }