Update to isl-0.18-410-gc253447

This is a regular maintenance update to ensure latest isl changes are tested
in our buildbots.

llvm-svn: 299350
This commit is contained in:
Tobias Grosser 2017-04-03 06:46:16 +00:00
parent 07944f891c
commit af940ae280
8 changed files with 103 additions and 69 deletions

View File

@ -1 +1 @@
isl-0.18-402-ga30c537
isl-0.18-410-gc253447

View File

@ -85,7 +85,7 @@ __isl_give isl_space *isl_space_extend(__isl_take isl_space *dim,
unsigned nparam, unsigned n_in, unsigned n_out);
__isl_give isl_space *isl_space_add_dims(__isl_take isl_space *space,
enum isl_dim_type type, unsigned n);
__isl_give isl_space *isl_space_move_dims(__isl_take isl_space *dim,
__isl_give isl_space *isl_space_move_dims(__isl_take isl_space *space,
enum isl_dim_type dst_type, unsigned dst_pos,
enum isl_dim_type src_type, unsigned src_pos, unsigned n);
__isl_give isl_space *isl_space_insert_dims(__isl_take isl_space *dim,

View File

@ -66,25 +66,6 @@ struct isl_basic_set *isl_basic_set_implicit_equalities(
isl_basic_map_implicit_equalities(bset_to_bmap(bset)));
}
struct isl_map *isl_map_implicit_equalities(struct isl_map *map)
{
int i;
if (!map)
return map;
for (i = 0; i < map->n; ++i) {
map->p[i] = isl_basic_map_implicit_equalities(map->p[i]);
if (!map->p[i])
goto error;
}
return map;
error:
isl_map_free(map);
return NULL;
}
/* Make eq[row][col] of both bmaps equal so we can add the row
* add the column to the common matrix.
* Note that because of the echelon form, the columns of row row

View File

@ -60,7 +60,7 @@ enum isl_lp_result isl_tab_solve_lp(struct isl_basic_map *bmap, int maximize,
* If opt_denom is NULL, then *opt is rounded up (or down)
* to the nearest integer.
* The return value reflects the nature of the result (empty, unbounded,
* minmimal or maximal value returned in *opt).
* minimal or maximal value returned in *opt).
*/
enum isl_lp_result isl_basic_map_solve_lp(struct isl_basic_map *bmap, int max,
isl_int *f, isl_int d, isl_int *opt,

View File

@ -620,7 +620,7 @@ static struct isl_basic_map *eliminate_divs_eq(
return bmap;
}
/* Elimininate divs based on inequalities
/* Eliminate divs based on inequalities
*/
static struct isl_basic_map *eliminate_divs_ineq(
struct isl_basic_map *bmap, int *progress)
@ -5232,6 +5232,13 @@ static __isl_give isl_vec *normalize_constraint(__isl_take isl_vec *v,
* We therefore call isl_basic_map_detect_inequality_pairs,
* which checks for such pairs of inequalities as well as eliminate_divs_eq
* and isl_basic_map_gauss if such a pair was found.
*
* Note that this function may leave the result in an inconsistent state.
* In particular, the constraints may not be gaussed.
* Unfortunately, isl_map_coalesce actually depends on this inconsistent state
* for some of the test cases to pass successfully.
* Any potential modification of the representation is therefore only
* performed on a single copy of the basic map.
*/
__isl_give isl_basic_map *isl_basic_map_reduce_coefficients(
__isl_take isl_basic_map *bmap)
@ -5271,6 +5278,10 @@ __isl_give isl_basic_map *isl_basic_map_reduce_coefficients(
return isl_basic_map_set_to_empty(bmap);
}
bmap = isl_basic_map_cow(bmap);
if (!bmap)
goto error;
tightened = 0;
for (i = 0; i < bmap->n_ineq; ++i) {
isl_seq_cpy(v->el, bmap->ineq[i], 1 + total);

View File

@ -3292,10 +3292,6 @@ __isl_give isl_qpolynomial *isl_qpolynomial_move_dims(
unsigned g_src_pos;
int *reordering;
if (n == 0)
return qp;
qp = isl_qpolynomial_cow(qp);
if (!qp)
return NULL;
@ -3308,6 +3304,15 @@ __isl_give isl_qpolynomial *isl_qpolynomial_move_dims(
if (src_type == isl_dim_in)
src_type = isl_dim_set;
if (n == 0 &&
!isl_space_is_named_or_nested(qp->dim, src_type) &&
!isl_space_is_named_or_nested(qp->dim, dst_type))
return qp;
qp = isl_qpolynomial_cow(qp);
if (!qp)
return NULL;
isl_assert(qp->dim->ctx, src_pos + n <= isl_space_dim(qp->dim, src_type),
goto error);

View File

@ -1074,101 +1074,98 @@ error:
return NULL;
}
__isl_give isl_space *isl_space_move_dims(__isl_take isl_space *dim,
__isl_give isl_space *isl_space_move_dims(__isl_take isl_space *space,
enum isl_dim_type dst_type, unsigned dst_pos,
enum isl_dim_type src_type, unsigned src_pos, unsigned n)
{
int i;
if (!dim)
space = isl_space_reset(space, src_type);
space = isl_space_reset(space, dst_type);
if (!space)
return NULL;
if (n == 0) {
dim = isl_space_reset(dim, src_type);
return isl_space_reset(dim, dst_type);
}
if (n == 0)
return space;
isl_assert(dim->ctx, src_pos + n <= isl_space_dim(dim, src_type),
isl_assert(space->ctx, src_pos + n <= isl_space_dim(space, src_type),
goto error);
if (dst_type == src_type && dst_pos == src_pos)
return dim;
return space;
isl_assert(dim->ctx, dst_type != src_type, goto error);
isl_assert(space->ctx, dst_type != src_type, goto error);
dim = isl_space_reset(dim, src_type);
dim = isl_space_reset(dim, dst_type);
dim = isl_space_cow(dim);
if (!dim)
space = isl_space_cow(space);
if (!space)
return NULL;
if (dim->ids) {
if (space->ids) {
isl_id **ids;
enum isl_dim_type t, o = isl_dim_param;
int off;
int s[3];
ids = isl_calloc_array(dim->ctx, isl_id *,
dim->nparam + dim->n_in + dim->n_out);
ids = isl_calloc_array(space->ctx, isl_id *,
space->nparam + space->n_in + space->n_out);
if (!ids)
goto error;
off = 0;
s[isl_dim_param - o] = dim->nparam;
s[isl_dim_in - o] = dim->n_in;
s[isl_dim_out - o] = dim->n_out;
s[isl_dim_param - o] = space->nparam;
s[isl_dim_in - o] = space->n_in;
s[isl_dim_out - o] = space->n_out;
for (t = isl_dim_param; t <= isl_dim_out; ++t) {
if (t == dst_type) {
get_ids(dim, t, 0, dst_pos, ids + off);
get_ids(space, t, 0, dst_pos, ids + off);
off += dst_pos;
get_ids(dim, src_type, src_pos, n, ids + off);
get_ids(space, src_type, src_pos, n, ids + off);
off += n;
get_ids(dim, t, dst_pos, s[t - o] - dst_pos,
get_ids(space, t, dst_pos, s[t - o] - dst_pos,
ids + off);
off += s[t - o] - dst_pos;
} else if (t == src_type) {
get_ids(dim, t, 0, src_pos, ids + off);
get_ids(space, t, 0, src_pos, ids + off);
off += src_pos;
get_ids(dim, t, src_pos + n,
get_ids(space, t, src_pos + n,
s[t - o] - src_pos - n, ids + off);
off += s[t - o] - src_pos - n;
} else {
get_ids(dim, t, 0, s[t - o], ids + off);
get_ids(space, t, 0, s[t - o], ids + off);
off += s[t - o];
}
}
free(dim->ids);
dim->ids = ids;
dim->n_id = dim->nparam + dim->n_in + dim->n_out;
free(space->ids);
space->ids = ids;
space->n_id = space->nparam + space->n_in + space->n_out;
}
switch (dst_type) {
case isl_dim_param: dim->nparam += n; break;
case isl_dim_in: dim->n_in += n; break;
case isl_dim_out: dim->n_out += n; break;
case isl_dim_param: space->nparam += n; break;
case isl_dim_in: space->n_in += n; break;
case isl_dim_out: space->n_out += n; break;
default: ;
}
switch (src_type) {
case isl_dim_param: dim->nparam -= n; break;
case isl_dim_in: dim->n_in -= n; break;
case isl_dim_out: dim->n_out -= n; break;
case isl_dim_param: space->nparam -= n; break;
case isl_dim_in: space->n_in -= n; break;
case isl_dim_out: space->n_out -= n; break;
default: ;
}
if (dst_type != isl_dim_param && src_type != isl_dim_param)
return dim;
return space;
for (i = 0; i < 2; ++i) {
if (!dim->nested[i])
if (!space->nested[i])
continue;
dim->nested[i] = isl_space_replace(dim->nested[i],
isl_dim_param, dim);
if (!dim->nested[i])
space->nested[i] = isl_space_replace(space->nested[i],
isl_dim_param, space);
if (!space->nested[i])
goto error;
}
return dim;
return space;
error:
isl_space_free(dim);
isl_space_free(space);
return NULL;
}

View File

@ -1970,6 +1970,44 @@ static int test_coalesce_special2(struct isl_ctx *ctx)
return 0;
}
/* Check that calling isl_set_coalesce does not leave other sets
* that may share some information with the input to isl_set_coalesce
* in an inconsistent state.
* In particular, older versions of isl would modify all copies
* of the basic sets in the isl_set_coalesce input in a way
* that could leave them in an inconsistent state.
* The result of printing any other set containing one of these
* basic sets would then result in an invalid set description.
*/
static int test_coalesce_special3(isl_ctx *ctx)
{
const char *str;
char *s;
isl_set *set1, *set2;
isl_printer *p;
set1 = isl_set_read_from_str(ctx, "{ [0, 0, 0] }");
str = "{ [a, b, a + b] : a >= 0 and b >= 0 and 0 < a + b }";
set2 = isl_set_read_from_str(ctx, str);
set1 = isl_set_union(set1, isl_set_copy(set2));
set1 = isl_set_coalesce(set1);
isl_set_free(set1);
p = isl_printer_to_str(ctx);
p = isl_printer_print_set(p, set2);
isl_set_free(set2);
s = isl_printer_get_str(p);
isl_printer_free(p);
set1 = isl_set_read_from_str(ctx, s);
free(s);
isl_set_free(set1);
if (!set1)
return -1;
return 0;
}
/* Test the functionality of isl_set_coalesce.
* That is, check that the output is always equal to the input
* and in some cases that the result consists of a single disjunct.
@ -1991,6 +2029,8 @@ static int test_coalesce(struct isl_ctx *ctx)
return -1;
if (test_coalesce_special2(ctx) < 0)
return -1;
if (test_coalesce_special3(ctx) < 0)
return -1;
return 0;
}