Merge branch 'maint'
authorSven Verdoolaege <skimo@kotnet.org>
Thu, 27 Dec 2012 10:20:13 +0000 (11:20 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Thu, 27 Dec 2012 10:20:13 +0000 (11:20 +0100)
isl_affine_hull.c
isl_input.c
isl_map.c
isl_test.c

index e71bc10..edfefe4 100644 (file)
@@ -1126,30 +1126,6 @@ __isl_give isl_basic_set *isl_basic_set_detect_equalities(
                isl_basic_map_detect_equalities((isl_basic_map *)bset);
 }
 
-__isl_give isl_map *isl_map_inline_foreach_basic_map(__isl_take isl_map *map,
-       __isl_give isl_basic_map *(*fn)(__isl_take isl_basic_map *bmap))
-{
-       struct isl_basic_map *bmap;
-       int i;
-
-       if (!map)
-               return NULL;
-
-       for (i = 0; i < map->n; ++i) {
-               bmap = isl_basic_map_copy(map->p[i]);
-               bmap = fn(bmap);
-               if (!bmap)
-                       goto error;
-               isl_basic_map_free(map->p[i]);
-               map->p[i] = bmap;
-       }
-
-       return map;
-error:
-       isl_map_free(map);
-       return NULL;
-}
-
 __isl_give isl_map *isl_map_detect_equalities(__isl_take isl_map *map)
 {
        return isl_map_inline_foreach_basic_map(map,
index f0c3d7c..b032bf1 100644 (file)
@@ -941,7 +941,11 @@ static __isl_give isl_multi_pw_aff *read_tuple_var_list(struct isl_stream *s,
                        new_name = p >= n;
                }
 
-               if (new_name) {
+               if (tok->type == '*') {
+                       if (vars_add_anon(v) < 0)
+                               goto error;
+                       isl_token_free(tok);
+               } else if (new_name) {
                        res = tuple_set_dim_name(res, i, v->v->name);
                        isl_token_free(tok);
                        if (isl_stream_eat_if_available(s, '='))
index 51a8600..922bbf9 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -5331,6 +5331,39 @@ static int remove_if_empty(__isl_keep isl_map *map, int i)
        return 0;
 }
 
+/* Perform "fn" on each basic map of "map", where we may not be holding
+ * the only reference to "map".
+ * In particular, "fn" should be a semantics preserving operation
+ * that we want to apply to all copies of "map".  We therefore need
+ * to be careful not to modify "map" in a way that breaks "map"
+ * in case anything goes wrong.
+ */
+__isl_give isl_map *isl_map_inline_foreach_basic_map(__isl_take isl_map *map,
+       __isl_give isl_basic_map *(*fn)(__isl_take isl_basic_map *bmap))
+{
+       struct isl_basic_map *bmap;
+       int i;
+
+       if (!map)
+               return NULL;
+
+       for (i = map->n - 1; i >= 0; --i) {
+               bmap = isl_basic_map_copy(map->p[i]);
+               bmap = fn(bmap);
+               if (!bmap)
+                       goto error;
+               isl_basic_map_free(map->p[i]);
+               map->p[i] = bmap;
+               if (remove_if_empty(map, i) < 0)
+                       goto error;
+       }
+
+       return map;
+error:
+       isl_map_free(map);
+       return NULL;
+}
+
 struct isl_map *isl_map_fix_si(struct isl_map *map,
                enum isl_dim_type type, unsigned pos, int value)
 {
@@ -10239,7 +10272,8 @@ __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
        isl_mat_free(eq);
        isl_mat_free(ineq);
 
-       return bmap;
+       bmap = isl_basic_map_simplify(bmap);
+       return isl_basic_map_finalize(bmap);
 error:
        isl_space_free(dim);
        isl_mat_free(eq);
index f0aee84..f59db99 100644 (file)
@@ -205,6 +205,9 @@ int test_parse(struct isl_ctx *ctx)
                                      "[n] -> { [i] : i <= n }") < 0)
                return -1;
 
+       if (test_parse_map_equal(ctx, "{ [*] }", "{ [a] }") < 0)
+               return -1;
+
        return 0;
 }