isl_transitive_closure.c: construct_component: always include identity
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 13 Apr 2010 07:54:17 +0000 (09:54 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 13 Apr 2010 07:54:17 +0000 (09:54 +0200)
Commit e06f258 (isl_map_transitive_closure: break early if input map
doesn't compose with itself) added a special case to construct_component,
but neglected to include the identity map in the result.

isl_test.c
isl_transitive_closure.c

index 384a973..187eacc 100644 (file)
@@ -931,6 +931,15 @@ void test_closure(struct isl_ctx *ctx)
        assert(isl_map_is_equal(map, map2));
        isl_map_free(map);
        isl_map_free(map2);
+
+       str = "{[0] -> [1]; [2] -> [3]}";
+       map = isl_map_read_from_str(ctx, str, -1);
+       map = isl_map_transitive_closure(map, &exact);
+       assert(exact);
+       map2 = isl_map_read_from_str(ctx, str, -1);
+       assert(isl_map_is_equal(map, map2));
+       isl_map_free(map);
+       isl_map_free(map2);
 }
 
 void test_lexmin(struct isl_ctx *ctx)
index 9e16184..1aefb5b 100644 (file)
@@ -756,12 +756,12 @@ static __isl_give isl_map *construct_component(__isl_take isl_dim *dim,
                isl_set_free(domain);
                isl_set_free(range);
                isl_set_free(overlap);
-               isl_dim_free(dim);
 
                map = isl_map_copy(map);
                map = isl_map_add(map, isl_dim_in, 1);
                map = isl_map_add(map, isl_dim_out, 1);
                map = set_path_length(map, 1, 1);
+               map = isl_map_union(map, isl_map_identity(isl_dim_domain(dim)));
                return map;
        }
        isl_set_free(overlap);