From 65868bc6a91a1a377be117aec3b1d7fe93f137d8 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 24 Aug 2012 19:38:39 +0200 Subject: [PATCH] isl_pw_*_gist: avoid intersection of domain with context The intersection was introduced in cf42ba2 (isl_pw_qpolynomial_gist: substitute equalities in polynomials, Mon Oct 25 13:49:22 2010 +0200) in order to be able to detect and exploit equalities in the intersection. However, there is no need to change the domain itself as we can just as well use a temporary object. Intersecting the domain with the context is not what the user would expect as the purpose of the gist operation is to only keep the most salient information, which is quite the opposite of introducing extra constraints. Signed-off-by: Sven Verdoolaege --- isl_pw_templ.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/isl_pw_templ.c b/isl_pw_templ.c index b80e084f..fa757c09 100644 --- a/isl_pw_templ.c +++ b/isl_pw_templ.c @@ -802,16 +802,17 @@ static __isl_give PW *FN(PW,gist_aligned)(__isl_take PW *pw, goto error; for (i = pw->n - 1; i >= 0; --i) { - pw->p[i].set = isl_set_intersect(pw->p[i].set, + isl_set *set_i; + int empty; + + set_i = isl_set_intersect(isl_set_copy(pw->p[i].set), isl_set_copy(context)); - if (!pw->p[i].set) - goto error; - pw->p[i].FIELD = fn_el(pw->p[i].FIELD, - isl_set_copy(pw->p[i].set)); + empty = isl_set_plain_is_empty(set_i); + pw->p[i].FIELD = fn_el(pw->p[i].FIELD, set_i); pw->p[i].set = fn_dom(pw->p[i].set, isl_basic_set_copy(hull)); - if (!pw->p[i].set) + if (!pw->p[i].FIELD || !pw->p[i].set) goto error; - if (isl_set_plain_is_empty(pw->p[i].set)) { + if (empty) { isl_set_free(pw->p[i].set); FN(EL,free)(pw->p[i].FIELD); if (i != pw->n - 1) -- 2.11.4.GIT