fix isl_basic_map_move_dims in presence of existentially quantified variables
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 23 Jul 2010 19:26:24 +0000 (21:26 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Fri, 23 Jul 2010 19:41:27 +0000 (21:41 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_map.c
isl_test.c

index 5a38cd5..e8edde5 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -2243,7 +2243,7 @@ __isl_give isl_basic_map *isl_basic_map_move_dims(
                        off += size;
                }
        }
-       isl_dim_map_div(dim_map, bmap, off + n);
+       isl_dim_map_div(dim_map, bmap, off);
 
        res = isl_basic_map_alloc_dim(isl_basic_map_get_dim(bmap),
                        bmap->n_div, bmap->n_eq, bmap->n_ineq);
index 2fc9d16..dcb417d 100644 (file)
@@ -97,6 +97,7 @@ void test_construction(struct isl_ctx *ctx)
 
 void test_dim(struct isl_ctx *ctx)
 {
+       const char *str;
        isl_map *map1, *map2;
 
        map1 = isl_map_read_from_str(ctx,
@@ -113,6 +114,16 @@ void test_dim(struct isl_ctx *ctx)
 
        isl_map_free(map1);
        isl_map_free(map2);
+
+       str = "[n] -> { [i] -> [] : exists a : 0 <= i <= n and i = 2 a }";
+       map1 = isl_map_read_from_str(ctx, str, -1);
+       str = "{ [i] -> [j] : exists a : 0 <= i <= j and i = 2 a }";
+       map2 = isl_map_read_from_str(ctx, str, -1);
+       map1 = isl_map_move_dims(map1, isl_dim_out, 0, isl_dim_param, 0, 1);
+       assert(isl_map_is_equal(map1, map2));
+
+       isl_map_free(map1);
+       isl_map_free(map2);
 }
 
 void test_div(struct isl_ctx *ctx)