From 695637f732ded0e12820db997e5b7b3a046754cc Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 16 May 2012 16:25:11 +0200 Subject: isl_morph.c: add_strides: clear newly added divs Although we know what the divs should look like, we leave it to isl_basic_map_simplify to extract them from the equalities we add. However, we should at least mark them as (initially) unknown as isl_basic_map_simplify may perform some other simplifications based on the div expressions. Signed-off-by: Sven Verdoolaege --- isl_morph.c | 1 + 1 file changed, 1 insertion(+) diff --git a/isl_morph.c b/isl_morph.c index b4f984a4..664bb75d 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; -- cgit v1.2.3 From 5cec5009084391edaa2ce790959414f5a2a54696 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 18 May 2012 11:25:58 +0200 Subject: isl_basic_map_zip: always call isl_basic_map_cow We were relying on isl_basic_map_swap_vars calling isl_basic_map_cow for us, but if no actual swapping needs to be performed (because the number of variables to swap is zero), then isl_basic_map_swap_vars will not call isl_basic_map_cow. Signed-off-by: Sven Verdoolaege --- isl_map.c | 1 + 1 file changed, 1 insertion(+) diff --git a/isl_map.c b/isl_map.c index 8c205b0c..3c08c2f4 100644 --- a/isl_map.c +++ b/isl_map.c @@ -9644,6 +9644,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; -- cgit v1.2.3 From c99f7c92c22ffc08f91e09076acaad6cffd7346f Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 18 May 2012 11:40:29 +0200 Subject: isl_space_set_dim_name: handle NULL name Signed-off-by: Sven Verdoolaege --- isl_space.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/isl_space.c b/isl_space.c index 48f63855..f4b1b2aa 100644 --- a/isl_space.c +++ b/isl_space.c @@ -468,6 +468,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) { @@ -528,6 +561,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); -- cgit v1.2.3 From 94baac520a8540685ce327b425de8b9e9e90faad Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 20 May 2012 15:11:58 -0400 Subject: Call finalize in isl_basic_map_set_dim_name Signed-off-by: Andreas Kloeckner Signed-off-by: Sven Verdoolaege --- isl_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/isl_map.c b/isl_map.c index 3c08c2f4..2c306378 100644 --- a/isl_map.c +++ b/isl_map.c @@ -501,7 +501,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; -- cgit v1.2.3