isl_set_product: call isl_map_range_product instead of isl_map_product
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 5 Aug 2011 16:02:18 +0000 (18:02 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Fri, 5 Aug 2011 16:03:16 +0000 (18:03 +0200)
A set only has a "range", so we should only compute the product of
that range and not of the domain.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_map.c
isl_test.c

index 0c2cd15..7496da7 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -7584,8 +7584,7 @@ __isl_give isl_map *isl_map_flat_product(__isl_take isl_map *map1,
  */
 struct isl_set *isl_set_product(struct isl_set *set1, struct isl_set *set2)
 {
-       return (struct isl_set *)isl_map_product((struct isl_map *)set1,
-                                                (struct isl_map *)set2);
+       return isl_map_range_product(set1, set2);
 }
 
 __isl_give isl_set *isl_set_flat_product(__isl_take isl_set *set1,
index d8248a3..4d1bfd1 100644 (file)
@@ -2337,6 +2337,25 @@ int test_dim_max(isl_ctx *ctx)
        return 0;
 }
 
+int test_product(isl_ctx *ctx)
+{
+       const char *str;
+       isl_set *set;
+       int ok;
+
+       str = "{ A[i] }";
+       set = isl_set_read_from_str(ctx, str, -1);
+       set = isl_set_product(set, isl_set_copy(set));
+       ok = isl_set_is_wrapping(set);
+       isl_set_free(set);
+       if (ok < 0)
+               return -1;
+       if (!ok)
+               isl_die(ctx, isl_error_unknown, "unexpected result", return -1);
+
+       return 0;
+}
+
 int main()
 {
        struct isl_ctx *ctx;
@@ -2345,6 +2364,8 @@ int main()
        assert(srcdir);
 
        ctx = isl_ctx_alloc();
+       if (test_product(ctx) < 0)
+               goto error;
        if (test_dim_max(ctx) < 0)
                goto error;
        if (test_aff(ctx) < 0)