unsigned isl_basic_map_dim(const struct isl_basic_map *bmap,
enum isl_dim_type type)
{
+ if (!bmap)
+ return 0;
switch (type) {
case isl_dim_param:
case isl_dim_in:
unsigned isl_basic_set_n_dim(const struct isl_basic_set *bset)
{
- return bset->dim->n_out;
+ return isl_basic_set_dim(bset, isl_dim_set);
}
unsigned isl_basic_set_n_param(const struct isl_basic_set *bset)
{
- return bset->dim->nparam;
+ return isl_basic_set_dim(bset, isl_dim_param);
}
unsigned isl_basic_set_total_dim(const struct isl_basic_set *bset)
unsigned isl_set_n_dim(const struct isl_set *set)
{
- return set->dim->n_out;
+ return isl_set_dim(set, isl_dim_set);
}
unsigned isl_set_n_param(const struct isl_set *set)
{
- return set->dim->nparam;
+ return isl_set_dim(set, isl_dim_param);
}
unsigned isl_basic_map_n_in(const struct isl_basic_map *bmap)
return NULL;
dim = isl_dim_alloc(base->ctx, nparam, n_in, n_out);
if (!dim)
- return NULL;
+ goto error;
bmap = isl_basic_map_extend_dim(base, dim, extra, n_eq, n_ineq);
return bmap;
+error:
+ isl_basic_map_free(base);
+ return NULL;
}
struct isl_basic_set *isl_basic_set_extend(struct isl_basic_set *base,
bmap = move_last(bmap, type, first, n);
bmap = isl_basic_map_cow(bmap);
+ if (!bmap)
+ return NULL;
row_size = 1 + isl_dim_total(bmap->dim) + bmap->extra;
old = bmap->block2.data;
return map;
error:
isl_map_free(map);
- return map;
+ return NULL;
}
/* Turn the n dimensions of type type, starting at first
if (ISL_F_ISSET(bmap, ISL_BASIC_MAP_RATIONAL)) {
struct isl_basic_map *copy = isl_basic_map_copy(bmap);
- copy = isl_basic_map_convex_hull(copy);
+ copy = isl_basic_map_remove_redundancies(copy);
empty = ISL_F_ISSET(copy, ISL_BASIC_MAP_EMPTY);
isl_basic_map_free(copy);
return empty;
return NULL;
if (ISL_F_ISSET(bmap, ISL_BASIC_MAP_NORMALIZED))
return bmap;
- bmap = isl_basic_map_convex_hull(bmap);
+ bmap = isl_basic_map_remove_redundancies(bmap);
bmap = isl_basic_map_sort_constraints(bmap);
ISL_F_SET(bmap, ISL_BASIC_MAP_NORMALIZED);
return bmap;