summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Verdoolaege <skimo@kotnet.org>2009-03-11 12:42:27 +0100
committerSven Verdoolaege <skimo@kotnet.org>2009-03-20 16:46:53 +0100
commitba4d1333b50530cf581e1bfcc96c2afc18b0d2c7 (patch)
tree017bbc00244fa3bd02c7ec6e7b0cebb9809b6593
parenta96dd9a5328e6515391298f4fed92506f0f0dcaf (diff)
downloadisl-ba4d1333b50530cf581e1bfcc96c2afc18b0d2c7.tar.gz
isl-ba4d1333b50530cf581e1bfcc96c2afc18b0d2c7.tar.bz2
isl-ba4d1333b50530cf581e1bfcc96c2afc18b0d2c7.zip
isl_map_simple_hull: compute affine hull before aligning divs
Computing the affine hull may change the internal representation. In particular, it may simplify div constraints that are added during the alignment to constraints that did not appear in the original set and we do not want to introduce such constraints in the simple hull.
-rw-r--r--isl_convex_hull.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/isl_convex_hull.c b/isl_convex_hull.c
index 9430efc1..be21837a 100644
--- a/isl_convex_hull.c
+++ b/isl_convex_hull.c
@@ -1727,26 +1727,17 @@ static struct isl_basic_set *uset_simple_hull(struct isl_set *set)
n_ineq += 2 * set->p[i]->n_eq + set->p[i]->n_ineq;
}
- hull = isl_set_affine_hull(isl_set_copy(set));
- if (!hull)
- goto error;
- hull = isl_basic_set_cow(hull),
- hull = isl_basic_set_extend_dim(hull, isl_dim_copy(hull->dim),
- 0, 0, n_ineq);
+ hull = isl_basic_set_alloc_dim(isl_dim_copy(set->dim), 0, 0, n_ineq);
if (!hull)
goto error;
data = sh_data_alloc(set, n_ineq);
if (!data)
goto error;
- if (hash_basic_set(data->hull_table, hull) < 0)
- goto error;
for (i = 0; i < set->n; ++i)
hull = add_bounds(hull, data, set, i);
- hull = isl_basic_set_convex_hull(hull);
-
sh_data_free(data);
isl_set_free(set);
@@ -1766,6 +1757,7 @@ struct isl_basic_map *isl_map_simple_hull(struct isl_map *map)
struct isl_set *set = NULL;
struct isl_basic_map *model = NULL;
struct isl_basic_map *hull;
+ struct isl_basic_map *affine_hull;
struct isl_basic_set *bset = NULL;
if (!map)
@@ -1782,6 +1774,7 @@ struct isl_basic_map *isl_map_simple_hull(struct isl_map *map)
}
map = isl_map_detect_equalities(map);
+ affine_hull = isl_map_affine_hull(isl_map_copy(map));
map = isl_map_align_divs(map);
model = isl_basic_map_copy(map->p[0]);
@@ -1791,6 +1784,8 @@ struct isl_basic_map *isl_map_simple_hull(struct isl_map *map)
hull = isl_basic_map_overlying_set(bset, model);
+ hull = isl_basic_map_intersect(hull, affine_hull);
+ hull = isl_basic_map_convex_hull(hull);
ISL_F_SET(hull, ISL_BASIC_MAP_NO_IMPLICIT);
ISL_F_SET(hull, ISL_BASIC_MAP_ALL_EQUALITIES);