X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=isl_ast_graft.c;h=0ec839bf408c5ce6053985f404b8faa9efb817eb;hb=63fb8a7f484648c3caa25351c8c94ac2395ec563;hp=2f21e8e5e38a45b6cee8f3ef15113496ded77bdf;hpb=4508a71c0360e91e3a649f0f21748843d518b791;p=platform%2Fupstream%2Fisl.git diff --git a/isl_ast_graft.c b/isl_ast_graft.c index 2f21e8e..0ec839b 100644 --- a/isl_ast_graft.c +++ b/isl_ast_graft.c @@ -7,7 +7,6 @@ * Ecole Normale Superieure, 45 rue d’Ulm, 75230 Paris, France */ -#include #include #include #include @@ -686,7 +685,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 +706,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,27 +1074,18 @@ __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. */ -__isl_give isl_ast_graft_list *isl_ast_graft_list_sort( +__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,