summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Verdoolaege <skimo@kotnet.org>2012-05-21 14:24:46 +0200
committerSven Verdoolaege <skimo@kotnet.org>2012-05-21 14:28:03 +0200
commit5b898f1e08d13ea4cbd90b149df11f5a8e4b7844 (patch)
tree2d23b14e560f7d05c670f128fb195921a1fe27c7
parent7c160a12ec1e3519b61024751247fc78214d04bb (diff)
parent94baac520a8540685ce327b425de8b9e9e90faad (diff)
downloadisl-5b898f1e08d13ea4cbd90b149df11f5a8e4b7844.tar.gz
isl-5b898f1e08d13ea4cbd90b149df11f5a8e4b7844.tar.bz2
isl-5b898f1e08d13ea4cbd90b149df11f5a8e4b7844.zip
Merge branch 'maint'
-rw-r--r--isl_map.c3
-rw-r--r--isl_morph.c1
-rw-r--r--isl_space.c35
3 files changed, 38 insertions, 1 deletions
diff --git a/isl_map.c b/isl_map.c
index 583a4a7c..036f4d5a 100644
--- a/isl_map.c
+++ b/isl_map.c
@@ -534,7 +534,7 @@ __isl_give isl_basic_map *isl_basic_map_set_dim_name(
bmap->dim = isl_space_set_dim_name(bmap->dim, type, pos, s);
if (!bmap->dim)
goto error;
- return bmap;
+ return isl_basic_map_finalize(bmap);
error:
isl_basic_map_free(bmap);
return NULL;
@@ -9819,6 +9819,7 @@ __isl_give isl_basic_map *isl_basic_map_zip(__isl_take isl_basic_map *bmap)
isl_space_dim(bmap->dim->nested[0], isl_dim_in);
n1 = isl_space_dim(bmap->dim->nested[0], isl_dim_out);
n2 = isl_space_dim(bmap->dim->nested[1], isl_dim_in);
+ bmap = isl_basic_map_cow(bmap);
bmap = isl_basic_map_swap_vars(bmap, pos, n1, n2);
if (!bmap)
return NULL;
diff --git a/isl_morph.c b/isl_morph.c
index 0aa0492b..230f14e6 100644
--- a/isl_morph.c
+++ b/isl_morph.c
@@ -581,6 +581,7 @@ static __isl_give isl_basic_set *add_strides(__isl_take isl_basic_set *bset,
div = isl_basic_set_alloc_div(bset);
if (div < 0)
goto error;
+ isl_int_set_si(bset->div[div][0], 0);
k = isl_basic_set_alloc_equality(bset);
if (k < 0)
goto error;
diff --git a/isl_space.c b/isl_space.c
index aae979a3..ee45615c 100644
--- a/isl_space.c
+++ b/isl_space.c
@@ -481,6 +481,39 @@ error:
return NULL;
}
+/* Reset the id of the given dimension of "space".
+ * If the dimension already has an id, then it is removed.
+ * If the dimension is a parameter, then we need to reset it
+ * in the nested spaces (if any) as well.
+ */
+__isl_give isl_space *isl_space_reset_dim_id(__isl_take isl_space *space,
+ enum isl_dim_type type, unsigned pos)
+{
+ space = isl_space_cow(space);
+ if (!space)
+ goto error;
+
+ if (type == isl_dim_param) {
+ int i;
+
+ for (i = 0; i < 2; ++i) {
+ if (!space->nested[i])
+ continue;
+ space->nested[i] =
+ isl_space_reset_dim_id(space->nested[i],
+ type, pos);
+ if (!space->nested[i])
+ goto error;
+ }
+ }
+
+ isl_id_free(get_id(space, type, pos));
+ return set_id(space, type, pos, NULL);
+error:
+ isl_space_free(space);
+ return NULL;
+}
+
int isl_space_has_dim_id(__isl_keep isl_space *dim,
enum isl_dim_type type, unsigned pos)
{
@@ -554,6 +587,8 @@ __isl_give isl_space *isl_space_set_dim_name(__isl_take isl_space *dim,
if (!dim)
return NULL;
+ if (!s)
+ return isl_space_reset_dim_id(dim, type, pos);
if (!name_ok(dim->ctx, s))
goto error;
id = isl_id_alloc(dim->ctx, s, NULL);