isl_local_space_intersect: add missing isl_local_space_cow when divs change
authorSven Verdoolaege <skimo@kotnet.org>
Thu, 1 May 2014 10:59:40 +0000 (1 12:59 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Thu, 1 May 2014 10:59:40 +0000 (1 12:59 +0200)
Reported-by: Michael Kruse <meinersbur@googlemail.com>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_local_space.c

index d3ca57a..76226cf 100644 (file)
@@ -653,6 +653,7 @@ __isl_give isl_local_space *isl_local_space_intersect(
        int *exp1 = NULL;
        int *exp2 = NULL;
        isl_mat *div;
+       int equal;
 
        if (!ls1 || !ls2)
                goto error;
@@ -681,6 +682,14 @@ __isl_give isl_local_space *isl_local_space_intersect(
        if (!div)
                goto error;
 
+       equal = isl_mat_is_equal(ls1->div, div);
+       if (equal < 0)
+               goto error;
+       if (!equal)
+               ls1 = isl_local_space_cow(ls1);
+       if (!ls1)
+               goto error;
+
        free(exp1);
        free(exp2);
        isl_local_space_free(ls2);