From a90b4956a04146b79e767ad60beebd186176b05d Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 31 Jan 2012 19:18:23 +0100 Subject: [PATCH] isl_union_set_product: call isl_set_product on entries Before, we would simply delegate control to isl_union_map_product, which calls isl_map_product on the entries. This doesn't work on isl_sets because they only have a "range" and no "domain". Signed-off-by: Sven Verdoolaege --- isl_test.c | 14 ++++++++++++++ isl_union_map.c | 14 +++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/isl_test.c b/isl_test.c index 737d3f8c..9bd7e25f 100644 --- a/isl_test.c +++ b/isl_test.c @@ -2451,6 +2451,7 @@ int test_product(isl_ctx *ctx) { const char *str; isl_set *set; + isl_union_set *uset1, *uset2; int ok; str = "{ A[i] }"; @@ -2463,6 +2464,19 @@ int test_product(isl_ctx *ctx) if (!ok) isl_die(ctx, isl_error_unknown, "unexpected result", return -1); + str = "{ [] }"; + uset1 = isl_union_set_read_from_str(ctx, str); + uset1 = isl_union_set_product(uset1, isl_union_set_copy(uset1)); + str = "{ [[] -> []] }"; + uset2 = isl_union_set_read_from_str(ctx, str); + ok = isl_union_set_is_equal(uset1, uset2); + isl_union_set_free(uset1); + isl_union_set_free(uset2); + if (ok < 0) + return -1; + if (!ok) + isl_die(ctx, isl_error_unknown, "unexpected result", return -1); + return 0; } diff --git a/isl_union_map.c b/isl_union_map.c index 445d4feb..f62a3029 100644 --- a/isl_union_map.c +++ b/isl_union_map.c @@ -1135,10 +1135,22 @@ __isl_give isl_union_map *isl_union_map_product(__isl_take isl_union_map *umap1, return bin_op(umap1, umap2, &product_entry); } +static int set_product_entry(void **entry, void *user) +{ + struct isl_union_map_bin_data *data = user; + isl_set *set2 = *entry; + + set2 = isl_set_product(isl_set_copy(data->map), isl_set_copy(set2)); + + data->res = isl_union_set_add_set(data->res, set2); + + return 0; +} + __isl_give isl_union_set *isl_union_set_product(__isl_take isl_union_set *uset1, __isl_take isl_union_set *uset2) { - return isl_union_map_product(uset1, uset2); + return bin_op(uset1, uset2, &set_product_entry); } static int range_product_entry(void **entry, void *user) -- 2.11.4.GIT