X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=isl_ast_graft.c;h=4ac773d37813edf65d29356a87105e667b6af297;hb=3733ac41c3a7ce80c561645cdd03c1535accc397;hp=4a2ee2e5fac4c8b5864c4b789deb4447292208e6;hpb=ada1705cf1dabf3d991c049b0d8a81b023adee41;p=platform%2Fupstream%2Fisl.git diff --git a/isl_ast_graft.c b/isl_ast_graft.c index 4a2ee2e..4ac773d 100644 --- a/isl_ast_graft.c +++ b/isl_ast_graft.c @@ -686,7 +686,8 @@ static __isl_give isl_basic_set *extract_shared_enforced( /* Record "guard" in "graft" so that it will be enforced somewhere * up the tree. If the graft already has a guard, then it may be partially * redundant in combination with the new guard and in the context - * of build->domain. We therefore (re)compute the gist of the intersection. + * of build->domain. We therefore (re)compute the gist of the intersection + * and coalesce the result. */ static __isl_give isl_ast_graft *store_guard(__isl_take isl_ast_graft *graft, __isl_take isl_set *guard, __isl_keep isl_ast_build *build) @@ -706,6 +707,7 @@ static __isl_give isl_ast_graft *store_guard(__isl_take isl_ast_graft *graft, graft->guard = isl_set_intersect(graft->guard, guard); graft->guard = isl_ast_build_compute_gist(build, graft->guard); + graft->guard = isl_set_coalesce(graft->guard); if (!graft->guard) return isl_ast_graft_free(graft); @@ -1073,12 +1075,10 @@ __isl_give isl_ast_graft_list *isl_ast_graft_list_preimage_multi_aff( /* Compare two grafts based on their guards. */ -static int cmp_graft(const void *a, const void *b) +static int cmp_graft(__isl_keep isl_ast_graft *a, __isl_keep isl_ast_graft *b, + void *user) { - isl_ast_graft * const *g1 = a; - isl_ast_graft * const *g2 = b; - - return isl_set_plain_cmp((*g1)->guard, (*g2)->guard); + return isl_set_plain_cmp(a->guard, b->guard); } /* Order the elements in "list" based on their guards. @@ -1086,14 +1086,7 @@ static int cmp_graft(const void *a, const void *b) __isl_give isl_ast_graft_list *isl_ast_graft_list_sort_guard( __isl_take isl_ast_graft_list *list) { - if (!list) - return NULL; - if (list->n <= 1) - return list; - - qsort(list->p, list->n, sizeof(list->p[0]), &cmp_graft); - - return list; + return isl_ast_graft_list_sort(list, &cmp_graft, NULL); } /* Merge the given two lists into a single list of grafts,