From: Sven Verdoolaege Date: Sun, 2 Jun 2013 08:57:15 +0000 (+0200) Subject: isl_pw_*_fix_val: also plug in value in associated functions X-Git-Tag: isl-0.12~25 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Fisl.git;a=commitdiff_plain;h=7a361e6e472e452b3fb6794c96f6ab983fc716cc isl_pw_*_fix_val: also plug in value in associated functions The original code would only plug in the value in the domains. Signed-off-by: Sven Verdoolaege --- diff --git a/isl_pw_templ.c b/isl_pw_templ.c index bb8d70e..3921c81 100644 --- a/isl_pw_templ.c +++ b/isl_pw_templ.c @@ -1130,14 +1130,11 @@ __isl_give PW *FN(PW,fix_dim)(__isl_take PW *pw, return NULL; for (i = 0; i < pw->n; ++i) { pw->p[i].set = isl_set_fix(pw->p[i].set, type, pos, v); - if (!pw->p[i].set) - goto error; + if (FN(PW,exploit_equalities_and_remove_if_empty)(pw, i) < 0) + return FN(PW,free)(pw); } return pw; -error: - FN(PW,free)(pw); - return NULL; } /* Fix the value of the variable at position "pos" of type "type" of "pw" diff --git a/isl_test.c b/isl_test.c index 1e90cbd..eeb2fc3 100644 --- a/isl_test.c +++ b/isl_test.c @@ -2112,6 +2112,20 @@ static int test_pwqp(struct isl_ctx *ctx) if (!equal) isl_die(ctx, isl_error_unknown, "unexpected result", return -1); + str = "{ [a,b,c] -> (([(2*[a/3]+1)/5]) * ([(2*[c/3]+1)/5])) : b = 1 }"; + pwqp2 = isl_pw_qpolynomial_read_from_str(ctx, str); + str = "{ [a,b,c] -> (([(2*[a/3]+b)/5]) * ([(2*[c/3]+b)/5])) }"; + pwqp1 = isl_pw_qpolynomial_read_from_str(ctx, str); + pwqp1 = isl_pw_qpolynomial_fix_val(pwqp1, isl_dim_set, 1, + isl_val_one(ctx)); + equal = isl_pw_qpolynomial_plain_is_equal(pwqp1, pwqp2); + isl_pw_qpolynomial_free(pwqp1); + isl_pw_qpolynomial_free(pwqp2); + if (equal < 0) + return -1; + if (!equal) + isl_die(ctx, isl_error_unknown, "unexpected result", return -1); + return 0; }