diff options
38 files changed, 373 insertions, 565 deletions
diff --git a/polly/lib/CMakeLists.txt b/polly/lib/CMakeLists.txt index 7b1c4a593cf..0dda000ecb6 100644 --- a/polly/lib/CMakeLists.txt +++ b/polly/lib/CMakeLists.txt @@ -36,7 +36,6 @@ set (ISL_FILES External/isl/isl_convex_hull.c External/isl/isl_ctx.c External/isl/isl_deprecated.c - External/isl/isl_dim.c External/isl/isl_dim_map.c External/isl/isl_equalities.c External/isl/isl_factorization.c diff --git a/polly/lib/External/isl/AUTHORS b/polly/lib/External/isl/AUTHORS index a08f5b12fb0..f3bddde84e3 100644 --- a/polly/lib/External/isl/AUTHORS +++ b/polly/lib/External/isl/AUTHORS @@ -34,6 +34,7 @@ Johannes Doerfert Tobias Grosser Alexandre Isoard Andreas Kloeckner +Michael Kruse Sebastian Pop Louis-Noel Pouchet Uday Kumar Reddy diff --git a/polly/lib/External/isl/ChangeLog b/polly/lib/External/isl/ChangeLog index a802e45909a..534646a8553 100644 --- a/polly/lib/External/isl/ChangeLog +++ b/polly/lib/External/isl/ChangeLog @@ -1,3 +1,9 @@ +version: 0.14.1 +date: Thu Apr 9 12:57:23 CEST 2015 +changes: + - fix bug in affine expression normalization + - fix handling of conditional validity constraints +--- version: 0.14 date: Sat Oct 25 16:08:47 CEST 2014 changes: diff --git a/polly/lib/External/isl/Makefile.am b/polly/lib/External/isl/Makefile.am index ca68b4caa5b..dff38754e94 100644 --- a/polly/lib/External/isl/Makefile.am +++ b/polly/lib/External/isl/Makefile.am @@ -85,7 +85,6 @@ libisl_la_SOURCES = \ isl_ctx.c \ isl_ctx_private.h \ isl_deprecated.c \ - isl_dim.c \ isl_dim_map.h \ isl_dim_map.c \ isl_equalities.c \ @@ -232,7 +231,6 @@ pkginclude_HEADERS = \ include/isl/band.h \ include/isl/constraint.h \ include/isl/ctx.h \ - include/isl/dim.h \ include/isl/flow.h \ include/isl/id.h \ include/isl/id_to_ast_expr.h \ diff --git a/polly/lib/External/isl/basis_reduction_tab.c b/polly/lib/External/isl/basis_reduction_tab.c index 112d423dbe0..cd97548508a 100644 --- a/polly/lib/External/isl/basis_reduction_tab.c +++ b/polly/lib/External/isl/basis_reduction_tab.c @@ -181,8 +181,11 @@ static int solve_lp(struct tab_lp *lp) isl_vec_free(sample); } isl_int_divexact_ui(lp->opt_denom, lp->opt_denom, 2); - if (res != isl_lp_ok) + if (res < 0) return -1; + if (res != isl_lp_ok) + isl_die(lp->ctx, isl_error_internal, + "unexpected missing (bounded) solution", return -1); return 0; } diff --git a/polly/lib/External/isl/basis_reduction_templ.c b/polly/lib/External/isl/basis_reduction_templ.c index 98d8141372b..4ce2d789b54 100644 --- a/polly/lib/External/isl/basis_reduction_templ.c +++ b/polly/lib/External/isl/basis_reduction_templ.c @@ -51,7 +51,6 @@ struct isl_tab *isl_tab_compute_reduced_basis(struct isl_tab *tab) unsigned dim; struct isl_ctx *ctx; struct isl_mat *B; - int unbounded; int i; GBR_LP *lp = NULL; GBR_type F_old, alpha, F_new; @@ -133,8 +132,8 @@ struct isl_tab *isl_tab_compute_reduced_basis(struct isl_tab *tab) GBR_lp_set_obj(lp, B->row[1+i]+1, dim); ctx->stats->gbr_solved_lps++; - unbounded = GBR_lp_solve(lp); - isl_assert(ctx, !unbounded, goto error); + if (GBR_lp_solve(lp) < 0) + goto error; GBR_lp_get_obj_val(lp, &F[i]); if (GBR_lt(F[i], one)) { @@ -151,8 +150,8 @@ struct isl_tab *isl_tab_compute_reduced_basis(struct isl_tab *tab) if (i+1 == tab->n_zero) { GBR_lp_set_obj(lp, B->row[1+i+1]+1, dim); ctx->stats->gbr_solved_lps++; - unbounded = GBR_lp_solve(lp); - isl_assert(ctx, !unbounded, goto error); + if (GBR_lp_solve(lp) < 0) + goto error; GBR_lp_get_obj_val(lp, &F_new); fixed = GBR_lp_is_fixed(lp); GBR_set_ui(alpha, 0); @@ -166,8 +165,8 @@ struct isl_tab *isl_tab_compute_reduced_basis(struct isl_tab *tab) row = GBR_lp_add_row(lp, B->row[1+i]+1, dim); GBR_lp_set_obj(lp, B->row[1+i+1]+1, dim); ctx->stats->gbr_solved_lps++; - unbounded = GBR_lp_solve(lp); - isl_assert(ctx, !unbounded, goto error); + if (GBR_lp_solve(lp) < 0) + goto error; GBR_lp_get_obj_val(lp, &F_new); fixed = GBR_lp_is_fixed(lp); @@ -196,8 +195,8 @@ struct isl_tab *isl_tab_compute_reduced_basis(struct isl_tab *tab) tmp, B->row[1+i]+1, dim); GBR_lp_set_obj(lp, b_tmp->el, dim); ctx->stats->gbr_solved_lps++; - unbounded = GBR_lp_solve(lp); - isl_assert(ctx, !unbounded, goto error); + if (GBR_lp_solve(lp) < 0) + goto error; GBR_lp_get_obj_val(lp, &mu_F[j]); mu_fixed[j] = GBR_lp_is_fixed(lp); if (i > 0) diff --git a/polly/lib/External/isl/codegen.c b/polly/lib/External/isl/codegen.c index 78483f7ea1d..30317d2d643 100644 --- a/polly/lib/External/isl/codegen.c +++ b/polly/lib/External/isl/codegen.c @@ -24,6 +24,8 @@ #include <isl/ast_build.h> #include <isl/options.h> #include <isl/set.h> +#include <isl/union_set.h> +#include <isl/union_map.h> #include <isl/stream.h> #include <isl/schedule_node.h> diff --git a/polly/lib/External/isl/configure.ac b/polly/lib/External/isl/configure.ac index f5d684b2d82..cd74a18b3bd 100644 --- a/polly/lib/External/isl/configure.ac +++ b/polly/lib/External/isl/configure.ac @@ -1,10 +1,10 @@ -AC_INIT([isl], [0.14], [isl-development@googlegroups.com]) +AC_INIT([isl], [0.14.1], [isl-development@googlegroups.com]) AC_CONFIG_AUX_DIR([.]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign]) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) AC_SUBST(versioninfo) -versioninfo=14:0:1 +versioninfo=14:1:1 if test "x$prefix" != "xNONE"; then prefix_wd=`cd $prefix && pwd` diff --git a/polly/lib/External/isl/include/isl/aff.h b/polly/lib/External/isl/include/isl/aff.h index 949474e895c..5b8a2aad4bf 100644 --- a/polly/lib/External/isl/include/isl/aff.h +++ b/polly/lib/External/isl/include/isl/aff.h @@ -910,6 +910,4 @@ ISL_DECLARE_LIST_FN(union_pw_multi_aff) } #endif -#include <isl/dim.h> - #endif diff --git a/polly/lib/External/isl/include/isl/constraint.h b/polly/lib/External/isl/include/isl/constraint.h index 70de5b5a823..8e504987458 100644 --- a/polly/lib/External/isl/include/isl/constraint.h +++ b/polly/lib/External/isl/include/isl/constraint.h @@ -143,6 +143,4 @@ void isl_constraint_dump(__isl_keep isl_constraint *c); } #endif -#include <isl/dim.h> - #endif diff --git a/polly/lib/External/isl/include/isl/dim.h b/polly/lib/External/isl/include/isl/dim.h deleted file mode 100644 index 6c439f5bbcc..00000000000 --- a/polly/lib/External/isl/include/isl/dim.h +++ /dev/null @@ -1,174 +0,0 @@ -#ifndef ISL_DIM_H -#define ISL_DIM_H - -#include <isl/space.h> -#include <isl/local_space.h> -#include <isl/aff_type.h> -#include <isl/constraint.h> -#include <isl/map_type.h> -#include <isl/set_type.h> -#include <isl/point.h> -#include <isl/union_map.h> -#include <isl/union_set.h> -#include <isl/polynomial_type.h> - -#if defined(__cplusplus) -extern "C" { -#endif - -#define isl_dim isl_space - -ISL_DEPRECATED -isl_ctx *isl_dim_get_ctx(__isl_keep isl_space *dim); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_alloc(isl_ctx *ctx, - unsigned nparam, unsigned n_in, unsigned n_out); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_set_alloc(isl_ctx *ctx, - unsigned nparam, unsigned dim); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_copy(__isl_keep isl_space *dim); -ISL_DEPRECATED -void isl_dim_free(__isl_take isl_space *dim); - -ISL_DEPRECATED -unsigned isl_dim_size(__isl_keep isl_space *dim, enum isl_dim_type type); - -ISL_DEPRECATED -__isl_give isl_space *isl_dim_set_dim_id(__isl_take isl_space *dim, - enum isl_dim_type type, unsigned pos, __isl_take isl_id *id); -ISL_DEPRECATED -int isl_dim_has_dim_id(__isl_keep isl_space *dim, - enum isl_dim_type type, unsigned pos); -ISL_DEPRECATED -__isl_give isl_id *isl_dim_get_dim_id(__isl_keep isl_space *dim, - enum isl_dim_type type, unsigned pos); - -ISL_DEPRECATED -int isl_dim_find_dim_by_id(__isl_keep isl_space *dim, - enum isl_dim_type type, __isl_keep isl_id *id); - -ISL_DEPRECATED -__isl_give isl_space *isl_dim_set_tuple_id(__isl_take isl_space *dim, - enum isl_dim_type type, __isl_take isl_id *id); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_reset_tuple_id(__isl_take isl_space *dim, - enum isl_dim_type type); -ISL_DEPRECATED -int isl_dim_has_tuple_id(__isl_keep isl_space *dim, enum isl_dim_type type); -ISL_DEPRECATED -__isl_give isl_id *isl_dim_get_tuple_id(__isl_keep isl_space *dim, - enum isl_dim_type type); - -ISL_DEPRECATED -__isl_give isl_space *isl_dim_set_name(__isl_take isl_space *dim, - enum isl_dim_type type, unsigned pos, __isl_keep const char *name); -ISL_DEPRECATED -__isl_keep const char *isl_dim_get_name(__isl_keep isl_space *dim, - enum isl_dim_type type, unsigned pos); - -ISL_DEPRECATED -__isl_give isl_space *isl_dim_set_tuple_name(__isl_take isl_space *dim, - enum isl_dim_type type, const char *s); -ISL_DEPRECATED -const char *isl_dim_get_tuple_name(__isl_keep isl_space *dim, - enum isl_dim_type type); - -ISL_DEPRECATED -int isl_dim_is_wrapping(__isl_keep isl_space *dim); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_wrap(__isl_take isl_space *dim); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_unwrap(__isl_take isl_space *dim); - -ISL_DEPRECATED -__isl_give isl_space *isl_dim_domain(__isl_take isl_space *dim); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_from_domain(__isl_take isl_space *dim); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_range(__isl_take isl_space *dim); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_from_range(__isl_take isl_space *dim); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_reverse(__isl_take isl_space *dim); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_join(__isl_take isl_space *left, - __isl_take isl_space *right); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_align_params(__isl_take isl_space *dim1, - __isl_take isl_space *dim2); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_insert(__isl_take isl_space *dim, - enum isl_dim_type type, unsigned pos, unsigned n); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_add(__isl_take isl_space *dim, - enum isl_dim_type type, unsigned n); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_drop(__isl_take isl_space *dim, - enum isl_dim_type type, unsigned first, unsigned n); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_move(__isl_take isl_space *dim, - enum isl_dim_type dst_type, unsigned dst_pos, - enum isl_dim_type src_type, unsigned src_pos, unsigned n); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_map_from_set( - __isl_take isl_space *dim); -ISL_DEPRECATED -__isl_give isl_space *isl_dim_zip(__isl_take isl_space *dim); - -ISL_DEPRECATED -__isl_give isl_local_space *isl_local_space_from_dim( - __isl_take isl_space *dim); -ISL_DEPRECATED -__isl_give isl_space *isl_local_space_get_dim( - __isl_keep isl_local_space *ls); - -ISL_DEPRECATED -__isl_give isl_space *isl_aff_get_dim(__isl_keep isl_aff *aff); -ISL_DEPRECATED -__isl_give isl_space *isl_pw_aff_get_dim(__isl_keep isl_pw_aff *pwaff); - -ISL_DEPRECATED -__isl_give isl_space *isl_constraint_get_dim( - __isl_keep isl_constraint *constraint); - -ISL_DEPRECATED -__isl_give isl_space *isl_basic_map_get_dim(__isl_keep isl_basic_map *bmap); -ISL_DEPRECATED -__isl_give isl_space *isl_map_get_dim(__isl_keep isl_map *map); -ISL_DEPRECATED -__isl_give isl_space *isl_union_map_get_dim(__isl_keep isl_union_map *umap); - -ISL_DEPRECATED -__isl_give isl_space *isl_basic_set_get_dim(__isl_keep isl_basic_set *bset); -ISL_DEPRECATED -__isl_give isl_space *isl_set_get_dim(__isl_keep isl_set *set); -ISL_DEPRECATED -__isl_give isl_space *isl_union_set_get_dim(__isl_keep isl_union_set *uset); - -ISL_DEPRECATED -__isl_give isl_space *isl_point_get_dim(__isl_keep isl_point *pnt); - -ISL_DEPRECATED -__isl_give isl_space *isl_qpolynomial_get_dim(__isl_keep isl_qpolynomial *qp); -ISL_DEPRECATED -__isl_give isl_space *isl_pw_qpolynomial_get_dim( - __isl_keep isl_pw_qpolynomial *pwqp); -ISL_DEPRECATED -__isl_give isl_space *isl_qpolynomial_fold_get_dim( - __isl_keep isl_qpolynomial_fold *fold); -ISL_DEPRECATED -__isl_give isl_space *isl_pw_qpolynomial_fold_get_dim( - __isl_keep isl_pw_qpolynomial_fold *pwf); -ISL_DEPRECATED -__isl_give isl_space *isl_union_pw_qpolynomial_get_dim( - __isl_keep isl_union_pw_qpolynomial *upwqp); -ISL_DEPRECATED -__isl_give isl_space *isl_union_pw_qpolynomial_fold_get_dim( - __isl_keep isl_union_pw_qpolynomial_fold *upwf); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/polly/lib/External/isl/include/isl/map.h b/polly/lib/External/isl/include/isl/map.h index 9c82ea92c72..7da71d3fc24 100644 --- a/polly/lib/External/isl/include/isl/map.h +++ b/polly/lib/External/isl/include/isl/map.h @@ -697,6 +697,4 @@ ISL_DECLARE_LIST_FN(map) } #endif -#include <isl/dim.h> - #endif diff --git a/polly/lib/External/isl/include/isl/point.h b/polly/lib/External/isl/include/isl/point.h index 3247ebb27c5..7e604c3caa2 100644 --- a/polly/lib/External/isl/include/isl/point.h +++ b/polly/lib/External/isl/include/isl/point.h @@ -40,6 +40,4 @@ void isl_point_dump(__isl_keep isl_point *pnt); } #endif -#include <isl/dim.h> - #endif diff --git a/polly/lib/External/isl/include/isl/polynomial.h b/polly/lib/External/isl/include/isl/polynomial.h index 4ccdcb4f20f..4487af10801 100644 --- a/polly/lib/External/isl/include/isl/polynomial.h +++ b/polly/lib/External/isl/include/isl/polynomial.h @@ -662,6 +662,4 @@ __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_to_polynomial( } #endif -#include <isl/dim.h> - #endif diff --git a/polly/lib/External/isl/include/isl/set.h b/polly/lib/External/isl/include/isl/set.h index 36589556e27..068e785a691 100644 --- a/polly/lib/External/isl/include/isl/set.h +++ b/polly/lib/External/isl/include/isl/set.h @@ -531,6 +531,4 @@ __isl_give char *isl_set_to_str(__isl_keep isl_set *set); } #endif -#include <isl/dim.h> - #endif diff --git a/polly/lib/External/isl/include/isl/union_map.h b/polly/lib/External/isl/include/isl/union_map.h index 5c0bbf553f8..31a942bb4a9 100644 --- a/polly/lib/External/isl/include/isl/union_map.h +++ b/polly/lib/External/isl/include/isl/union_map.h @@ -2,6 +2,7 @@ #define ISL_UNION_MAP_H #include <isl/space.h> +#include <isl/aff_type.h> #include <isl/map_type.h> #include <isl/union_map_type.h> #include <isl/printer.h> @@ -264,6 +265,4 @@ ISL_DECLARE_LIST_FN(union_map) } #endif -#include <isl/dim.h> - #endif diff --git a/polly/lib/External/isl/include/isl/union_set.h b/polly/lib/External/isl/include/isl/union_set.h index 52985d411a8..7591ce2952d 100644 --- a/polly/lib/External/isl/include/isl/union_set.h +++ b/polly/lib/External/isl/include/isl/union_set.h @@ -155,6 +155,4 @@ __isl_give isl_union_set *isl_union_set_list_union( } #endif -#include <isl/dim.h> - #endif diff --git a/polly/lib/External/isl/isl_ast_build.c b/polly/lib/External/isl/isl_ast_build.c index 80623f07bc8..dc54b9772c9 100644 --- a/polly/lib/External/isl/isl_ast_build.c +++ b/polly/lib/External/isl/isl_ast_build.c @@ -12,7 +12,10 @@ #include <isl/map.h> #include <isl/aff.h> +#include <isl/constraint.h> #include <isl/map.h> +#include <isl/union_set.h> +#include <isl/union_map.h> #include <isl_ast_build_private.h> #include <isl_ast_private.h> diff --git a/polly/lib/External/isl/isl_ast_build_expr.c b/polly/lib/External/isl/isl_ast_build_expr.c index 83b12a13d59..1b84d882b45 100644 --- a/polly/lib/External/isl/isl_ast_build_expr.c +++ b/polly/lib/External/isl/isl_ast_build_expr.c @@ -10,6 +10,7 @@ * B.P. 105 - 78153 Le Chesnay, France */ +#include <isl/constraint.h> #include <isl/ilp.h> #include <isl_ast_build_expr.h> #include <isl_ast_private.h> diff --git a/polly/lib/External/isl/isl_ast_codegen.c b/polly/lib/External/isl/isl_ast_codegen.c index 001fe7ff0f0..2c709990dff 100644 --- a/polly/lib/External/isl/isl_ast_codegen.c +++ b/polly/lib/External/isl/isl_ast_codegen.c @@ -12,8 +12,10 @@ #include <limits.h> #include <isl/aff.h> +#include <isl/constraint.h> #include <isl/set.h> #include <isl/ilp.h> +#include <isl/union_set.h> #include <isl/union_map.h> #include <isl/schedule_node.h> #include <isl_sort.h> diff --git a/polly/lib/External/isl/isl_coalesce.c b/polly/lib/External/isl/isl_coalesce.c index 2ebe600ff6f..0c26cf0891a 100644 --- a/polly/lib/External/isl/isl_coalesce.c +++ b/polly/lib/External/isl/isl_coalesce.c @@ -484,6 +484,8 @@ static enum isl_change check_facets(int i, int j, if (info[j].ineq[l] != STATUS_CUT) continue; stat = status_in(info[j].bmap->ineq[l], info[i].tab); + if (stat < 0) + return isl_change_error; if (stat != STATUS_VALID) break; } @@ -519,9 +521,13 @@ static int contains(struct isl_coalesce_info *info, struct isl_tab *tab) isl_seq_neg(bmap->eq[k], bmap->eq[k], 1 + dim); stat = status_in(bmap->eq[k], tab); isl_seq_neg(bmap->eq[k], bmap->eq[k], 1 + dim); + if (stat < 0) + return -1; if (stat != STATUS_VALID) return 0; stat = status_in(bmap->eq[k], tab); + if (stat < 0) + return -1; if (stat != STATUS_VALID) return 0; } @@ -531,6 +537,8 @@ static int contains(struct isl_coalesce_info *info, struct isl_tab *tab) if (info->ineq[k] == STATUS_REDUNDANT) continue; stat = status_in(bmap->ineq[k], tab); + if (stat < 0) + return -1; if (stat != STATUS_VALID) return 0; } @@ -582,6 +590,7 @@ static enum isl_change is_adj_ineq_extension(int i, int j, unsigned n_eq = info[i].bmap->n_eq; unsigned total = isl_basic_map_total_dim(info[i].bmap); int r; + int super; if (isl_tab_extend_cons(info[i].tab, 1 + info[j].bmap->n_ineq) < 0) return isl_change_error; @@ -614,7 +623,10 @@ static enum isl_change is_adj_ineq_extension(int i, int j, return isl_change_error; } - if (contains(&info[j], info[i].tab)) + super = contains(&info[j], info[i].tab); + if (super < 0) + return isl_change_error; + if (super) return fuse(i, j, info, NULL, 0, 0); if (isl_tab_rollback(info[i].tab, snap) < 0) @@ -725,6 +737,8 @@ static enum isl_change is_adj_eq_extension(int i, int j, int k, if (isl_tab_select_facet(info[i].tab, n_eq + k) < 0) return isl_change_error; super = contains(&info[j], info[i].tab); + if (super < 0) + return isl_change_error; if (super) { int l; unsigned total; @@ -2119,6 +2133,7 @@ static __isl_give isl_aff_list *set_up_substitutions( return list; error: + isl_aff_free(aff_nan); isl_local_space_free(ls); isl_basic_set_free(wrap_hull); isl_aff_list_free(list); @@ -2354,7 +2369,7 @@ static enum isl_change check_coalesce_into_eq(int i, int j, list = set_up_substitutions(info[i].bmap, info[j].bmap, hull_j); if (!list) - goto error; + return isl_change_error; if (isl_aff_list_n_aff(list) < n_div_i) change = isl_change_none; else diff --git a/polly/lib/External/isl/isl_dim.c b/polly/lib/External/isl/isl_dim.c deleted file mode 100644 index 914d666b38e..00000000000 --- a/polly/lib/External/isl/isl_dim.c +++ /dev/null @@ -1,258 +0,0 @@ -#include <isl/dim.h> -#include <isl/aff.h> -#include <isl/map.h> -#include <isl/set.h> -#include <isl/polynomial.h> - -isl_ctx *isl_dim_get_ctx(__isl_keep isl_space *dim) -{ - return isl_space_get_ctx(dim); -} - -__isl_give isl_space *isl_dim_alloc(isl_ctx *ctx, - unsigned nparam, unsigned n_in, unsigned n_out) -{ - return isl_space_alloc(ctx, nparam, n_in, n_out); -} -__isl_give isl_space *isl_dim_set_alloc(isl_ctx *ctx, - unsigned nparam, unsigned dim) -{ - return isl_space_set_alloc(ctx, nparam, dim); -} -__isl_give isl_space *isl_dim_copy(__isl_keep isl_space *dim) -{ - return isl_space_copy(dim); -} -void isl_dim_free(__isl_take isl_space *dim) -{ - isl_space_free(dim); -} - -unsigned isl_dim_size(__isl_keep isl_space *dim, enum isl_dim_type type) -{ - return isl_space_dim(dim, type); -} - -__isl_give isl_space *isl_dim_set_dim_id(__isl_take isl_space *dim, - enum isl_dim_type type, unsigned pos, __isl_take isl_id *id) -{ - return isl_space_set_dim_id(dim, type, pos, id); -} -int isl_dim_has_dim_id(__isl_keep isl_space *dim, - enum isl_dim_type type, unsigned pos) -{ - return isl_space_has_dim_id(dim, type, pos); -} -__isl_give isl_id *isl_dim_get_dim_id(__isl_keep isl_space *dim, - enum isl_dim_type type, unsigned pos) -{ - return isl_space_get_dim_id(dim, type, pos); -} - -int isl_dim_find_dim_by_id(__isl_keep isl_space *dim, - enum isl_dim_type type, __isl_keep isl_id *id) -{ - return isl_space_find_dim_by_id(dim, type, id); -} - -__isl_give isl_space *isl_dim_set_tuple_id(__isl_take isl_space *dim, - enum isl_dim_type type, __isl_take isl_id *id) -{ - return isl_space_set_tuple_id(dim, type, id); -} -__isl_give isl_space *isl_dim_reset_tuple_id(__isl_take isl_space *dim, - enum isl_dim_type type) -{ - return isl_space_reset_tuple_id(dim, type); -} -int isl_dim_has_tuple_id(__isl_keep isl_space *dim, enum isl_dim_type type) -{ - return isl_space_has_tuple_id(dim, type); -} -__isl_give isl_id *isl_dim_get_tuple_id(__isl_keep isl_space *dim, - enum isl_dim_type type) -{ - return isl_space_get_tuple_id(dim, type); -} - -__isl_give isl_space *isl_dim_set_name(__isl_take isl_space *dim, - enum isl_dim_type type, unsigned pos, __isl_keep const char *name) -{ - return isl_space_set_dim_name(dim, type, pos, name); -} -__isl_keep const char *isl_dim_get_name(__isl_keep isl_space *dim, - enum isl_dim_type type, unsigned pos) -{ - return isl_space_get_dim_name(dim, type, pos); -} - -__isl_give isl_space *isl_dim_set_tuple_name(__isl_take isl_space *dim, - enum isl_dim_type type, const char *s) -{ - return isl_space_set_tuple_name(dim, type, s); -} -const char *isl_dim_get_tuple_name(__isl_keep isl_space *dim, - enum isl_dim_type type) -{ - return isl_space_get_tuple_name(dim, type); -} - -int isl_dim_is_wrapping(__isl_keep isl_space *dim) -{ - return isl_space_is_wrapping(dim); -} -__isl_give isl_space *isl_dim_wrap(__isl_take isl_space *dim) -{ - return isl_space_wrap(dim); -} -__isl_give isl_space *isl_dim_unwrap(__isl_take isl_space *dim) -{ - return isl_space_unwrap(dim); -} - -__isl_give isl_space *isl_dim_domain(__isl_take isl_space *dim) -{ - return isl_space_domain(dim); -} -__isl_give isl_space *isl_dim_from_domain(__isl_take isl_space *dim) -{ - return isl_space_from_domain(dim); -} -__isl_give isl_space *isl_dim_range(__isl_take isl_space *dim) -{ - return isl_space_range(dim); -} -__isl_give isl_space *isl_dim_from_range(__isl_take isl_space *dim) -{ - return isl_space_from_range(dim); -} -__isl_give isl_space *isl_dim_reverse(__isl_take isl_space *dim) -{ - return isl_space_reverse(dim); -} -__isl_give isl_space *isl_dim_join(__isl_take isl_space *left, - __isl_take isl_space *right) -{ - return isl_space_join(left, right); -} -__isl_give isl_space *isl_dim_align_params(__isl_take isl_space *dim1, - __isl_take isl_space *dim2) -{ - return isl_space_align_params(dim1, dim2); -} -__isl_give isl_space *isl_dim_insert(__isl_take isl_space *dim, - enum isl_dim_type type, unsigned pos, unsigned n) -{ - return isl_space_insert_dims(dim, type, pos, n); -} -__isl_give isl_space *isl_dim_add(__isl_take isl_space *dim, - enum isl_dim_type type, unsigned n) -{ - return isl_space_add_dims(dim, type, n); -} -__isl_give isl_space *isl_dim_drop(__isl_take isl_space *dim, - enum isl_dim_type type, unsigned first, unsigned n) -{ - return isl_space_drop_dims(dim, type, first, n); -} -__isl_give isl_space *isl_dim_move(__isl_take isl_space *dim, - enum isl_dim_type dst_type, unsigned dst_pos, - enum isl_dim_type src_type, unsigned src_pos, unsigned n) -{ - return isl_space_move_dims(dim, dst_type, dst_pos, src_type, src_pos, n); -} -__isl_give isl_space *isl_dim_map_from_set(__isl_take isl_space *dim) -{ - return isl_space_map_from_set(dim); -} -__isl_give isl_space *isl_dim_zip(__isl_take isl_space *dim) -{ - return isl_space_zip(dim); -} - -__isl_give isl_local_space *isl_local_space_from_dim( - __isl_take isl_space *dim) -{ - return isl_local_space_from_space(dim); -} -__isl_give isl_space *isl_local_space_get_dim( - __isl_keep isl_local_space *ls) -{ - return isl_local_space_get_space(ls); -} - -__isl_give isl_space *isl_aff_get_dim(__isl_keep isl_aff *aff) -{ - return isl_aff_get_space(aff); -} -__isl_give isl_space *isl_pw_aff_get_dim(__isl_keep isl_pw_aff *pwaff) -{ - return isl_pw_aff_get_space(pwaff); -} - -__isl_give isl_space *isl_constraint_get_dim( - __isl_keep isl_constraint *constraint) -{ - return isl_constraint_get_space(constraint); -} - -__isl_give isl_space *isl_basic_map_get_dim(__isl_keep isl_basic_map *bmap) -{ - return isl_basic_map_get_space(bmap); -} -__isl_give isl_space *isl_map_get_dim(__isl_keep isl_map *map) -{ - return isl_map_get_space(map); -} -__isl_give isl_space *isl_union_map_get_dim(__isl_keep isl_union_map *umap) -{ - return isl_union_map_get_space(umap); -} - -__isl_give isl_space *isl_basic_set_get_dim(__isl_keep isl_basic_set *bset) -{ - return isl_basic_set_get_space(bset); -} -__isl_give isl_space *isl_set_get_dim(__isl_keep isl_set *set) -{ - return isl_set_get_space(set); -} -__isl_give isl_space *isl_union_set_get_dim(__isl_keep isl_union_set *uset) -{ - return isl_union_set_get_space(uset); -} - -__isl_give isl_space *isl_point_get_dim(__isl_keep isl_point *pnt) -{ - return isl_point_get_space(pnt); -} - -__isl_give isl_space *isl_qpolynomial_get_dim(__isl_keep isl_qpolynomial *qp) -{ - return isl_qpolynomial_get_space(qp); -} -__isl_give isl_space *isl_pw_qpolynomial_get_dim( - __isl_keep isl_pw_qpolynomial *pwqp) -{ - return isl_pw_qpolynomial_get_space(pwqp); -} -__isl_give isl_space *isl_qpolynomial_fold_get_dim( - __isl_keep isl_qpolynomial_fold *fold) -{ - return isl_qpolynomial_fold_get_space(fold); -} -__isl_give isl_space *isl_pw_qpolynomial_fold_get_dim( - __isl_keep isl_pw_qpolynomial_fold *pwf) -{ - return isl_pw_qpolynomial_fold_get_space(pwf); -} -__isl_give isl_space *isl_union_pw_qpolynomial_get_dim( - __isl_keep isl_union_pw_qpolynomial *upwqp) -{ - return isl_union_pw_qpolynomial_get_space(upwqp); -} -__isl_give isl_space *isl_union_pw_qpolynomial_fold_get_dim( - __isl_keep isl_union_pw_qpolynomial_fold *upwf) -{ - return isl_union_pw_qpolynomial_fold_get_space(upwf); -} diff --git a/polly/lib/External/isl/isl_flow.c b/polly/lib/External/isl/isl_flow.c index 80f20fe502c..b3497a6d2eb 100644 --- a/polly/lib/External/isl/isl_flow.c +++ b/polly/lib/External/isl/isl_flow.c @@ -18,6 +18,8 @@ #include <isl/set.h> #include <isl/map.h> +#include <isl/union_set.h> +#include <isl/union_map.h> #include <isl/flow.h> #include <isl/schedule_node.h> #include <isl_sort.h> @@ -1958,6 +1960,9 @@ static void isl_compute_flow_schedule_data_clear( { int i; + if (!data->sink) + return; + for (i = 0; i < data->n_sink; ++i) { isl_map_free(data->sink[i].access); isl_schedule_node_free(data->sink[i].node); diff --git a/polly/lib/External/isl/isl_fold.c b/polly/lib/External/isl/isl_fold.c index 104475ddef6..939f0c7875f 100644 --- a/polly/lib/External/isl/isl_fold.c +++ b/polly/lib/External/isl/isl_fold.c @@ -234,10 +234,23 @@ error: return NULL; } +/* Determine the sign of the constant quasipolynomial "qp". + * + * Return + * -1 if qp <= 0 + * 1 if qp >= 0 + * 0 if unknown + * + * For qp == 0, we can return either -1 or 1. In practice, we return 1. + * For qp == NaN, the sign is undefined, so we return 0. + */ static int isl_qpolynomial_cst_sign(__isl_keep isl_qpolynomial *qp) { struct isl_upoly_cst *cst; + if (isl_qpolynomial_is_nan(qp)) + return 0; + cst = isl_upoly_as_cst(qp->upoly); if (!cst) return 0; @@ -438,7 +451,13 @@ __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_fold_on_domain( for (i = 0; i < fold2->n; ++i) { for (j = n1 - 1; j >= 0; --j) { isl_qpolynomial *d; - int sgn; + int sgn, equal; + equal = isl_qpolynomial_plain_is_equal(res->qp[j], + fold2->qp[i]); + if (equal < 0) + goto error; + if (equal) + break; d = isl_qpolynomial_sub( isl_qpolynomial_copy(res->qp[j]), isl_qpolynomial_copy(fold2->qp[i])); diff --git a/polly/lib/External/isl/isl_input.c b/polly/lib/External/isl/isl_input.c index 7cc603c52a0..fc4ef307e6e 100644 --- a/polly/lib/External/isl/isl_input.c +++ b/polly/lib/External/isl/isl_input.c @@ -22,6 +22,7 @@ #include <isl_stream_private.h> #include <isl/obj.h> #include "isl_polynomial_private.h" +#include <isl/union_set.h> #include <isl/union_map.h> #include <isl_mat_private.h> #include <isl_aff_private.h> diff --git a/polly/lib/External/isl/isl_map.c b/polly/lib/External/isl/isl_map.c index 7bc6d14b099..6cfc1da8f6b 100644 --- a/polly/lib/External/isl/isl_map.c +++ b/polly/lib/External/isl/isl_map.c @@ -19,6 +19,7 @@ #include <isl_ctx_private.h> #include <isl_map_private.h> #include <isl_blk.h> +#include <isl/constraint.h> #include "isl_space_private.h" #include "isl_equalities.h" #include <isl_lp_private.h> @@ -9066,6 +9067,9 @@ int isl_basic_map_plain_cmp(const __isl_keep isl_basic_map *bmap1, int i, cmp; unsigned total; + if (!bmap1 || !bmap2) + return -1; + if (bmap1 == bmap2) return 0; if (ISL_F_ISSET(bmap1, ISL_BASIC_MAP_RATIONAL) != diff --git a/polly/lib/External/isl/isl_map_list.c b/polly/lib/External/isl/isl_map_list.c index 6e818c59636..5e9305f6441 100644 --- a/polly/lib/External/isl/isl_map_list.c +++ b/polly/lib/External/isl/isl_map_list.c @@ -1,4 +1,5 @@ #include <isl/map.h> +#include <isl/union_map.h> #undef EL #define EL isl_basic_map diff --git a/polly/lib/External/isl/isl_map_simplify.c b/polly/lib/External/isl/isl_map_simplify.c index dd75abca7dd..8ad4304fe8d 100644 --- a/polly/lib/External/isl/isl_map_simplify.c +++ b/polly/lib/External/isl/isl_map_simplify.c @@ -1758,8 +1758,8 @@ static struct isl_basic_set *remove_shifted_constraints( int k, h, l; isl_ctx *ctx; - if (!bset) - return NULL; + if (!bset || !context) + return bset; size = round_up(4 * (context->n_ineq+1) / 3 - 1); if (size == 0) @@ -3404,7 +3404,7 @@ static __isl_give isl_vec *normalize_constraint(__isl_take isl_vec *v, * opposite inequalities that can be replaced by an equality. * We therefore call isl_basic_map_detect_inequality_pairs, * which checks for such pairs of inequalities as well as eliminate_divs_eq - * if such a pair was found. + * and isl_basic_map_gauss if such a pair was found. */ __isl_give isl_basic_map *isl_basic_map_reduce_coefficients( __isl_take isl_basic_map *bmap) @@ -3465,8 +3465,10 @@ __isl_give isl_basic_map *isl_basic_map_reduce_coefficients( int progress = 0; bmap = isl_basic_map_detect_inequality_pairs(bmap, &progress); - if (progress) + if (progress) { bmap = eliminate_divs_eq(bmap, &progress); + bmap = isl_basic_map_gauss(bmap, NULL); + } } return bmap; diff --git a/polly/lib/External/isl/isl_map_subtract.c b/polly/lib/External/isl/isl_map_subtract.c index 4d10cab807d..67e78c558ba 100644 --- a/polly/lib/External/isl/isl_map_subtract.c +++ b/polly/lib/External/isl/isl_map_subtract.c @@ -491,16 +491,32 @@ static __isl_give isl_map *basic_map_subtract(__isl_take isl_basic_map *bmap, return sdc.diff; } +/* Return an empty map living in the same space as "map1" and "map2". + */ +static __isl_give isl_map *replace_pair_by_empty( __isl_take isl_map *map1, + __isl_take isl_map *map2) +{ + isl_space *space; + + space = isl_map_get_space(map1); + isl_map_free(map1); + isl_map_free(map2); + return isl_map_empty(space); +} + /* Return the set difference between map1 and map2. * (U_i A_i) \ (U_j B_j) is computed as U_i (A_i \ (U_j B_j)) * + * If "map1" and "map2" are obviously equal to each other, + * then return an empty map in the same space. + * * If "map1" and "map2" are disjoint, then simply return "map1". */ static __isl_give isl_map *map_subtract( __isl_take isl_map *map1, __isl_take isl_map *map2) { int i; - int disjoint; + int equal, disjoint; struct isl_map *diff; if (!map1 || !map2) @@ -508,6 +524,12 @@ static __isl_give isl_map *map_subtract( __isl_take isl_map *map1, isl_assert(map1->ctx, isl_space_is_equal(map1->dim, map2->dim), goto error); + equal = isl_map_plain_is_equal(map1, map2); + if (equal < 0) + goto error; + if (equal) + return replace_pair_by_empty(map1, map2); + disjoint = isl_map_is_disjoint(map1, map2); if (disjoint < 0) goto error; diff --git a/polly/lib/External/isl/isl_obj.c b/polly/lib/External/isl/isl_obj.c index 460c123e13c..e12035fcf8d 100644 --- a/polly/lib/External/isl/isl_obj.c +++ b/polly/lib/External/isl/isl_obj.c @@ -16,6 +16,8 @@ #include <isl/aff.h> #include <isl/set.h> #include <isl/map.h> +#include <isl/union_set.h> +#include <isl/union_map.h> #include <isl/polynomial.h> #include <isl/schedule.h> #include <isl/obj.h> diff --git a/polly/lib/External/isl/isl_scheduler.c b/polly/lib/External/isl/isl_scheduler.c index db31a69567a..856c9851fcd 100644 --- a/polly/lib/External/isl/isl_scheduler.c +++ b/polly/lib/External/isl/isl_scheduler.c @@ -22,6 +22,7 @@ #include <isl_mat_private.h> #include <isl_vec_private.h> #include <isl/set.h> +#include <isl/union_set.h> #include <isl_seq.h> #include <isl_tab.h> #include <isl_dim_map.h> diff --git a/polly/lib/External/isl/isl_set_list.c b/polly/lib/External/isl/isl_set_list.c index 9f77c41578d..33344138727 100644 --- a/polly/lib/External/isl/isl_set_list.c +++ b/polly/lib/External/isl/isl_set_list.c @@ -1,4 +1,5 @@ #include <isl/set.h> +#include <isl/union_set.h> #undef EL #define EL isl_basic_set diff --git a/polly/lib/External/isl/isl_space.c b/polly/lib/External/isl/isl_space.c index 952e5b54867..ceb556076a7 100644 --- a/polly/lib/External/isl/isl_space.c +++ b/polly/lib/External/isl/isl_space.c @@ -911,9 +911,9 @@ error: __isl_give isl_space *isl_space_add_dims(__isl_take isl_space *dim, enum isl_dim_type type, unsigned n) { + dim = isl_space_reset(dim, type); if (!dim) return NULL; - dim = isl_space_reset(dim, type); switch (type) { case isl_dim_param: dim = isl_space_extend(dim, diff --git a/polly/lib/External/isl/isl_tab_pip.c b/polly/lib/External/isl/isl_tab_pip.c index 49ede65195b..63603e5e0a8 100644 --- a/polly/lib/External/isl/isl_tab_pip.c +++ b/polly/lib/External/isl/isl_tab_pip.c @@ -564,9 +564,8 @@ static void sol_map_free_wrap(struct isl_sol *sol) static void sol_map_add_empty(struct isl_sol_map *sol, struct isl_basic_set *bset) { - if (!bset) + if (!bset || !sol->empty) goto error; - isl_assert(bset->ctx, sol->empty, goto error); sol->empty = isl_set_grow(sol->empty, 1); bset = isl_basic_set_simplify(bset); @@ -2790,7 +2789,7 @@ static struct isl_vec *gbr_get_sample(struct isl_context_gbr *cgbr) sample = isl_tab_sample(cgbr->tab); - if (isl_tab_rollback(cgbr->tab, snap) < 0) { + if (!sample || isl_tab_rollback(cgbr->tab, snap) < 0) { isl_vec_free(sample); return NULL; } @@ -3266,10 +3265,8 @@ static void context_gbr_restore(struct isl_context *context, void *save) struct isl_gbr_tab_undo *snap = (struct isl_gbr_tab_undo *)save; if (!snap) goto error; - if (isl_tab_rollback(cgbr->tab, snap->tab_snap) < 0) { - isl_tab_free(cgbr->tab); - cgbr->tab = NULL; - } + if (isl_tab_rollback(cgbr->tab, snap->tab_snap) < 0) + goto error; if (snap->shifted_snap) { if (isl_tab_rollback(cgbr->shifted, snap->shifted_snap) < 0) @@ -5253,9 +5250,8 @@ static void sol_pma_free(struct isl_sol_pma *sol_pma) static void sol_pma_add_empty(struct isl_sol_pma *sol, __isl_take isl_basic_set *bset) { - if (!bset) + if (!bset || !sol->empty) goto error; - isl_assert(bset->ctx, sol->empty, goto error); sol->empty = isl_set_grow(sol->empty, 1); bset = isl_basic_set_simplify(bset); diff --git a/polly/lib/External/isl/isl_test.c b/polly/lib/External/isl/isl_test.c index 25e9341a338..a5dab947e48 100644 --- a/polly/lib/External/isl/isl_test.c +++ b/polly/lib/External/isl/isl_test.c @@ -25,6 +25,7 @@ #include <isl/flow.h> #include <isl_constraint_private.h> #include <isl/polynomial.h> +#include <isl/union_set.h> #include <isl/union_map.h> #include <isl_factorization.h> #include <isl/schedule.h> @@ -275,12 +276,13 @@ int test_parse(struct isl_ctx *ctx) return 0; } -void test_read(struct isl_ctx *ctx) +static int test_read(isl_ctx *ctx) { char *filename; FILE *input; - struct isl_basic_set *bset1, *bset2; + isl_basic_set *bset1, *bset2; const char *str = "{[y]: Exists ( alpha : 2alpha = y)}"; + int equal; filename = get_filename(ctx, "set", "omega"); assert(filename); @@ -290,44 +292,70 @@ void test_read(struct isl_ctx *ctx) bset1 = isl_basic_set_read_from_file(ctx, input); bset2 = isl_basic_set_read_from_str(ctx, str); - assert(isl_basic_set_is_equal(bset1, bset2) == 1); + equal = isl_basic_set_is_equal(bset1, bset2); isl_basic_set_free(bset1); isl_basic_set_free(bset2); free(filename); fclose(input); + + if (equal < 0) + return -1; + if (!equal) + isl_die(ctx, isl_error_unknown, + "read sets not equal", return -1); + + return 0; } -void test_bounded(struct isl_ctx *ctx) +static int test_bounded(isl_ctx *ctx) { isl_set *set; int bounded; set = isl_set_read_from_str(ctx, "[n] -> {[i] : 0 <= i <= n }"); bounded = isl_set_is_bounded(set); - assert(bounded); isl_set_free(set); + if (bounded < 0) + return -1; + if (!bounded) + isl_die(ctx, isl_error_unknown, + "set not considered bounded", return -1); + set = isl_set_read_from_str(ctx, "{[n, i] : 0 <= i <= n }"); bounded = isl_set_is_bounded(set); assert(!bounded); isl_set_free(set); + if (bounded < 0) + return -1; + if (bounded) + isl_die(ctx, isl_error_unknown, + "set considered bounded", return -1); + set = isl_set_read_from_str(ctx, "[n] -> {[i] : i <= n }"); bounded = isl_set_is_bounded(set); - assert(!bounded); isl_set_free(set); + + if (bounded < 0) + return -1; + if (bounded) + isl_die(ctx, isl_error_unknown, + "set considered bounded", return -1); + + return 0; } /* Construct the basic set { [i] : 5 <= i <= N } */ -void test_construction(struct isl_ctx *ctx) +static int test_construction(isl_ctx *ctx) { isl_int v; isl_space *dim; isl_local_space *ls; - struct isl_basic_set *bset; - struct isl_constraint *c; + isl_basic_set *bset; + isl_constraint *c; isl_int_init(v); @@ -353,37 +381,54 @@ void test_construction(struct isl_ctx *ctx) isl_basic_set_free(bset); isl_int_clear(v); + + return 0; } -void test_dim(struct isl_ctx *ctx) +static int test_dim(isl_ctx *ctx) { const char *str; isl_map *map1, *map2; + int equal; map1 = isl_map_read_from_str(ctx, "[n] -> { [i] -> [j] : exists (a = [i/10] : i - 10a <= n ) }"); map1 = isl_map_add_dims(map1, isl_dim_in, 1); map2 = isl_map_read_from_str(ctx, "[n] -> { [i,k] -> [j] : exists (a = [i/10] : i - 10a <= n ) }"); - assert(isl_map_is_equal(map1, map2)); + equal = isl_map_is_equal(map1, map2); isl_map_free(map2); map1 = isl_map_project_out(map1, isl_dim_in, 0, 1); map2 = isl_map_read_from_str(ctx, "[n] -> { [i] -> [j] : n >= 0 }"); - assert(isl_map_is_equal(map1, map2)); + if (equal >= 0 && equal) + equal = isl_map_is_equal(map1, map2); isl_map_free(map1); isl_map_free(map2); + if (equal < 0) + return -1; + if (!equal) + isl_die(ctx, isl_error_unknown, + "unexpected result", return -1); + str = "[n] -> { [i] -> [] : exists a : 0 <= i <= n and i = 2 a }"; map1 = isl_map_read_from_str(ctx, str); str = "{ [i] -> [j] : exists a : 0 <= i <= j and i = 2 a }"; map2 = isl_map_read_from_str(ctx, str); map1 = isl_map_move_dims(map1, isl_dim_out, 0, isl_dim_param, 0, 1); - assert(isl_map_is_equal(map1, map2)); - + equal = isl_map_is_equal(map1, map2); isl_map_free(map1); isl_map_free(map2); + + if (equal < 0) + return -1; + if (!equal) + isl_die(ctx, isl_error_unknown, + "unexpected result", return -1); + + return 0; } struct { @@ -972,10 +1017,12 @@ void test_application_case(struct isl_ctx *ctx, const char *name) fclose(input); } -void test_application(struct isl_ctx *ctx) +static int test_application(isl_ctx *ctx) { test_application_case(ctx, "application"); test_application_case(ctx, "application2"); + + return 0; } void test_affine_hull_case(struct isl_ctx *ctx, const char *name) @@ -1104,7 +1151,7 @@ struct { "{ [x, y] : 1 = 0 }" }, }; -void test_convex_hull_algo(struct isl_ctx *ctx, int convex) +static int test_convex_hull_algo(isl_ctx *ctx, int convex) { int i; int orig_convex = ctx->opt->convex; @@ -1129,22 +1176,34 @@ void test_convex_hull_algo(struct isl_ctx *ctx, int convex) for (i = 0; i < ARRAY_SIZE(convex_hull_tests); ++i) { isl_set *set1, *set2; + int equal; set1 = isl_set_read_from_str(ctx, convex_hull_tests[i].set); set2 = isl_set_read_from_str(ctx, convex_hull_tests[i].hull); set1 = isl_set_from_basic_set(isl_set_convex_hull(set1)); - assert(isl_set_is_equal(set1, set2)); + equal = isl_set_is_equal(set1, set2); isl_set_free(set1); isl_set_free(set2); + + if (equal < 0) + return -1; + if (!equal) + isl_die(ctx, isl_error_unknown, + "unexpected convex hull", return -1); } ctx->opt->convex = orig_convex; + + return 0; } -void test_convex_hull(struct isl_ctx *ctx) +static int test_convex_hull(isl_ctx *ctx) { - test_convex_hull_algo(ctx, ISL_CONVEX_HULL_FM); - test_convex_hull_algo(ctx, ISL_CONVEX_HULL_WRAP); + if (test_convex_hull_algo(ctx, ISL_CONVEX_HULL_FM) < 0) + return -1; + if (test_convex_hull_algo(ctx, ISL_CONVEX_HULL_WRAP) < 0) + return -1; + return 0; } void test_gist_case(struct isl_ctx *ctx, const char *name) @@ -1530,6 +1589,14 @@ struct { "n <= 2147483647 and t0 <= 31 and t0 >= 0 and i0 >= 11 and " "i0 >= 96 - 3t0 and i0 <= 95 + n - 3t0 and i0 <= 7 + n and " "i8 >= -40 + i0 and i8 <= -10 + i0)) }" }, + { 0, "{ [i0, i1, i2] : " + "(exists (e0, e1 = floor((i0)/32), e2 = floor((i1)/32): " + "32e1 = i0 and 32e2 = i1 and i1 >= -31 + i0 and " + "i1 <= 31 + i0 and i2 >= -30 + i0 and i2 >= -30 + i1 and " + "32e0 >= -30 + i0 and 32e0 >= -30 + i1 and " + "32e0 >= -31 + i2 and 32e0 <= 30 + i2 and 32e0 <= 31 + i1 and " + "32e0 <= 31 + i0)) or " + "i0 >= 0 }" }, }; /* A specialized coalescing test case that would result @@ -1594,7 +1661,7 @@ static int test_coalesce(struct isl_ctx *ctx) return 0; } -void test_closure(struct isl_ctx *ctx) +static int test_closure(isl_ctx *ctx) { const char *str; isl_set *dom; @@ -1831,17 +1898,28 @@ void test_closure(struct isl_ctx *ctx) map = isl_map_transitive_closure(map, NULL); assert(map); isl_map_free(map); + + return 0; } -void test_lex(struct isl_ctx *ctx) +static int test_lex(struct isl_ctx *ctx) { isl_space *dim; isl_map *map; + int empty; dim = isl_space_set_alloc(ctx, 0, 0); map = isl_map_lex_le(dim); - assert(!isl_map_is_empty(map)); + empty = isl_map_is_empty(map); isl_map_free(map); + + if (empty < 0) + return -1; + if (empty) + isl_die(ctx, isl_error_unknown, + "expecting non-empty result", return -1); + + return 0; } static int test_lexmin(struct isl_ctx *ctx) @@ -2046,7 +2124,7 @@ static int map_check_equal(__isl_keep isl_map *map, const char *str) return 0; } -void test_dep(struct isl_ctx *ctx) +static int test_dep(struct isl_ctx *ctx) { const char *str; isl_space *dim; @@ -2232,6 +2310,8 @@ void test_dep(struct isl_ctx *ctx) isl_map_free(mm.must); isl_map_free(mm.may); isl_flow_free(flow); + + return 0; } /* Check that the dependence analysis proceeds without errors. @@ -2299,33 +2379,46 @@ int test_sv(isl_ctx *ctx) return 0; } -void test_bijective_case(struct isl_ctx *ctx, const char *str, int bijective) +struct { + const char *str; + int bijective; +} bijective_tests[] = { + { "[N,M]->{[i,j] -> [i]}", 0 }, + { "[N,M]->{[i,j] -> [i] : j=i}", 1 }, + { "[N,M]->{[i,j] -> [i] : j=0}", 1 }, + { "[N,M]->{[i,j] -> [i] : j=N}", 1 }, + { "[N,M]->{[i,j] -> [j,i]}", 1 }, + { "[N,M]->{[i,j] -> [i+j]}", 0 }, + { "[N,M]->{[i,j] -> []}", 0 }, + { "[N,M]->{[i,j] -> [i,j,N]}", 1 }, + { "[N,M]->{[i,j] -> [2i]}", 0 }, + { "[N,M]->{[i,j] -> [i,i]}", 0 }, + { "[N,M]->{[i,j] -> [2i,i]}", 0 }, + { "[N,M]->{[i,j] -> [2i,j]}", 1 }, + { "[N,M]->{[i,j] -> [x,y] : 2x=i & y =j}", 1 }, +}; + +static int test_bijective(struct isl_ctx *ctx) { isl_map *map; + int i; + int bijective; - map = isl_map_read_from_str(ctx, str); - if (bijective) - assert(isl_map_is_bijective(map)); - else - assert(!isl_map_is_bijective(map)); - isl_map_free(map); -} + for (i = 0; i < ARRAY_SIZE(bijective_tests); ++i) { + map = isl_map_read_from_str(ctx, bijective_tests[i].str); + bijective = isl_map_is_bijective(map); + isl_map_free(map); + if (bijective < 0) + return -1; + if (bijective_tests[i].bijective && !bijective) + isl_die(ctx, isl_error_internal, + "map not detected as bijective", return -1); + if (!bijective_tests[i].bijective && bijective) + isl_die(ctx, isl_error_internal, + "map detected as bijective", return -1); + } -void test_bijective(struct isl_ctx *ctx) -{ - test_bijective_case(ctx, "[N,M]->{[i,j] -> [i]}", 0); - test_bijective_case(ctx, "[N,M]->{[i,j] -> [i] : j=i}", 1); - test_bijective_case(ctx, "[N,M]->{[i,j] -> [i] : j=0}", 1); - test_bijective_case(ctx, "[N,M]->{[i,j] -> [i] : j=N}", 1); - test_bijective_case(ctx, "[N,M]->{[i,j] -> [j,i]}", 1); - test_bijective_case(ctx, "[N,M]->{[i,j] -> [i+j]}", 0); - test_bijective_case(ctx, "[N,M]->{[i,j] -> []}", 0); - test_bijective_case(ctx, "[N,M]->{[i,j] -> [i,j,N]}", 1); - test_bijective_case(ctx, "[N,M]->{[i,j] -> [2i]}", 0); - test_bijective_case(ctx, "[N,M]->{[i,j] -> [i,i]}", 0); - test_bijective_case(ctx, "[N,M]->{[i,j] -> [2i,i]}", 0); - test_bijective_case(ctx, "[N,M]->{[i,j] -> [2i,j]}", 1); - test_bijective_case(ctx, "[N,M]->{[i,j] -> [x,y] : 2x=i & y =j}", 1); + return 0; } /* Inputs for isl_pw_qpolynomial_gist tests. @@ -2446,7 +2539,7 @@ static int test_pwqp(struct isl_ctx *ctx) return 0; } -void test_split_periods(isl_ctx *ctx) +static int test_split_periods(isl_ctx *ctx) { const char *str; isl_pw_qpolynomial *pwqp; @@ -2457,16 +2550,21 @@ void test_split_periods(isl_ctx *ctx) pwqp = isl_pw_qpolynomial_read_from_str(ctx, str); pwqp = isl_pw_qpolynomial_split_periods(pwqp, 2); - assert(pwqp); isl_pw_qpolynomial_free(pwqp); + + if (!pwqp) + return -1; + + return 0; } -void test_union(isl_ctx *ctx) +static int test_union(isl_ctx *ctx) { const char *str; isl_union_set *uset1, *uset2; isl_union_map *umap1, *umap2; + int equal; str = "{ [i] : 0 <= i <= 1 }"; uset1 = isl_union_set_read_from_str(ctx, str); @@ -2474,11 +2572,17 @@ void test_union(isl_ctx *ctx) umap1 = isl_union_map_read_from_str(ctx, str); umap2 = isl_union_set_lex_gt_union_set(isl_union_set_copy(uset1), uset1); - assert(isl_union_map_is_equal(umap1, umap2)); + equal = isl_union_map_is_equal(umap1, umap2); isl_union_map_free(umap1); isl_union_map_free(umap2); + if (equal < 0) + return -1; + if (!equal) + isl_die(ctx, isl_error_unknown, "union maps not equal", + return -1); + str = "{ A[i] -> B[i]; B[i] -> C[i]; A[0] -> C[1] }"; umap1 = isl_union_map_read_from_str(ctx, str); str = "{ A[i]; B[i] }"; @@ -2486,32 +2590,85 @@ void test_union(isl_ctx *ctx) uset2 = isl_union_map_domain(umap1); - assert(isl_union_set_is_equal(uset1, uset2)); + equal = isl_union_set_is_equal(uset1, uset2); isl_union_set_free(uset1); isl_union_set_free(uset2); + + if (equal < 0) + return -1; + if (!equal) + isl_die(ctx, isl_error_unknown, "union sets not equal", + return -1); + + return 0; +} + +/* Check that computing a bound of a non-zero polynomial over an unbounded + * domain does not produce a rational value. + * Ideally, we want the value to be infinity, but we accept NaN for now. + * We certainly do not want to obtain the value zero. + */ +static int test_bound_unbounded_domain(isl_ctx *ctx) +{ + const char *str; + isl_set *dom; + isl_point *pnt; + isl_pw_qpolynomial *pwqp; + isl_pw_qpolynomial_fold *pwf; + isl_val *v; + int is_rat; + + str = "{ [m,n] -> -m * n }"; + pwqp = isl_pw_qpolynomial_read_from_str(ctx, str); + pwf = isl_pw_qpolynomial_bound(pwqp, isl_fold_max, NULL); + dom = isl_pw_qpolynomial_fold_domain(isl_pw_qpolynomial_fold_copy(pwf)); + pnt = isl_set_sample_point(dom); + v = isl_pw_qpolynomial_fold_eval(pwf, pnt); + is_rat = isl_val_is_rat(v); + isl_val_free(v); + + if (is_rat < 0) + return -1; + if (is_rat) + isl_die(ctx, isl_error_unknown, + "unexpected rational value", return -1); + + return 0; } -void test_bound(isl_ctx *ctx) +static int test_bound(isl_ctx *ctx) { const char *str; + unsigned dim; isl_pw_qpolynomial *pwqp; isl_pw_qpolynomial_fold *pwf; + if (test_bound_unbounded_domain(ctx) < 0) + return -1; + str = "{ [[a, b, c, d] -> [e]] -> 0 }"; pwqp = isl_pw_qpolynomial_read_from_str(ctx, str); pwf = isl_pw_qpolynomial_bound(pwqp, isl_fold_max, NULL); - assert(isl_pw_qpolynomial_fold_dim(pwf, isl_dim_in) == 4); + dim = isl_pw_qpolynomial_fold_dim(pwf, isl_dim_in); isl_pw_qpolynomial_fold_free(pwf); + if (dim != 4) + isl_die(ctx, isl_error_unknown, "unexpected input dimension", + return -1); str = "{ [[x]->[x]] -> 1 : exists a : x = 2 a }"; pwqp = isl_pw_qpolynomial_read_from_str(ctx, str); pwf = isl_pw_qpolynomial_bound(pwqp, isl_fold_max, NULL); - assert(isl_pw_qpolynomial_fold_dim(pwf, isl_dim_in) == 1); + dim = isl_pw_qpolynomial_fold_dim(pwf, isl_dim_in); isl_pw_qpolynomial_fold_free(pwf); + if (dim != 1) + isl_die(ctx, isl_error_unknown, "unexpected input dimension", + return -1); + + return 0; } -void test_lift(isl_ctx *ctx) +static int test_lift(isl_ctx *ctx) { const char *str; isl_basic_map *bmap; @@ -2523,6 +2680,8 @@ void test_lift(isl_ctx *ctx) bmap = isl_basic_map_from_range(bset); bset = isl_basic_map_domain(bmap); isl_basic_set_free(bset); + + return 0; } struct { @@ -5657,6 +5816,20 @@ struct { { "min", &test_min }, { "gist", &test_gist }, { "piecewise quasi-polynomials", &test_pwqp }, + { "lift", &test_lift }, + { "bound", &test_bound }, + { "union", &test_union }, + { "split periods", &test_split_periods }, + { "lexicographic order", &test_lex }, + { "bijectivity", &test_bijective }, + { "dataflow analysis", &test_dep }, + { "reading", &test_read }, + { "bounded", &test_bounded }, + { "construction", &test_construction }, + { "dimension manipulation", &test_dim }, + { "map application", &test_application }, + { "convex hull", &test_convex_hull }, + { "transitive closure", &test_closure }, }; int main(int argc, char **argv) @@ -5678,20 +5851,6 @@ int main(int argc, char **argv) if (tests[i].fn(ctx) < 0) goto error; } - test_lift(ctx); - test_bound(ctx); - test_union(ctx); - test_split_periods(ctx); - test_lex(ctx); - test_bijective(ctx); - test_dep(ctx); - test_read(ctx); - test_bounded(ctx); - test_construction(ctx); - test_dim(ctx); - test_application(ctx); - test_convex_hull(ctx); - test_closure(ctx); isl_ctx_free(ctx); return 0; error: diff --git a/polly/lib/External/isl/isl_transitive_closure.c b/polly/lib/External/isl/isl_transitive_closure.c index e14987cf2e6..40083ab8db0 100644 --- a/polly/lib/External/isl/isl_transitive_closure.c +++ b/polly/lib/External/isl/isl_transitive_closure.c @@ -70,13 +70,15 @@ static __isl_give isl_map *set_path_length(__isl_take isl_map *map, bmap = isl_basic_map_alloc_space(dim, 0, 1, 1); if (exactly) { k = isl_basic_map_alloc_equality(bmap); + if (k < 0) + goto error; c = bmap->eq[k]; } else { k = isl_basic_map_alloc_inequality(bmap); + if (k < 0) + goto error; c = bmap->ineq[k]; } - if (k < 0) - goto error; isl_seq_clr(c, 1 + isl_basic_map_total_dim(bmap)); isl_int_set_si(c[0], -length); isl_int_set_si(c[1 + nparam + d - 1], -1); @@ -474,13 +476,15 @@ static __isl_give isl_basic_map *add_delta_constraints( continue; if (eq && p != MIXED) { k = isl_basic_map_alloc_equality(path); + if (k < 0) + goto error; path_c = path->eq[k]; } else { k = isl_basic_map_alloc_inequality(path); + if (k < 0) + goto error; path_c = path->ineq[k]; } - if (k < 0) - goto error; isl_seq_clr(path_c, 1 + isl_basic_map_total_dim(path)); if (p == PURE_VAR) { isl_seq_cpy(path_c + off, @@ -754,6 +758,9 @@ static __isl_give isl_map *construct_extended_path(__isl_take isl_space *dim, unsigned d; int i, j, n; + if (!map) + goto error; + d = isl_map_dim(map, isl_dim_in); path = isl_map_identity(isl_space_copy(dim)); @@ -819,6 +826,9 @@ static int isl_set_overlaps(__isl_keep isl_set *set1, __isl_keep isl_set *set2) isl_set *i; int no_overlap; + if (!set1 || !set2) + return -1; + if (!isl_space_tuple_is_equal(set1->dim, isl_dim_set, set2->dim, isl_dim_set)) return 0; @@ -856,16 +866,20 @@ static __isl_give isl_map *construct_component(__isl_take isl_space *dim, struct isl_set *range = NULL; struct isl_map *app = NULL; struct isl_map *path = NULL; + int overlaps; domain = isl_map_domain(isl_map_copy(map)); domain = isl_set_coalesce(domain); range = isl_map_range(isl_map_copy(map)); range = isl_set_coalesce(range); - if (!isl_set_overlaps(domain, range)) { + overlaps = isl_set_overlaps(domain, range); + if (overlaps < 0 || !overlaps) { isl_set_free(domain); isl_set_free(range); isl_space_free(dim); + if (overlaps < 0) + map = NULL; map = isl_map_copy(map); map = isl_map_add_dims(map, isl_dim_in, 1); map = isl_map_add_dims(map, isl_dim_out, 1); diff --git a/polly/lib/Makefile b/polly/lib/Makefile index 8e2ff1b4b36..9c6cbd8af55 100644 --- a/polly/lib/Makefile +++ b/polly/lib/Makefile @@ -48,7 +48,6 @@ ISL_FILES= External/isl/basis_reduction_tab.c \ External/isl/isl_convex_hull.c \ External/isl/isl_ctx.c \ External/isl/isl_deprecated.c \ - External/isl/isl_dim.c \ External/isl/isl_dim_map.c \ External/isl/isl_equalities.c \ External/isl/isl_factorization.c \ diff --git a/polly/test/DependenceInfo/sequential_loops.ll b/polly/test/DependenceInfo/sequential_loops.ll index c97b0f5d5e4..cc2cdce4223 100644 --- a/polly/test/DependenceInfo/sequential_loops.ll +++ b/polly/test/DependenceInfo/sequential_loops.ll @@ -50,7 +50,7 @@ exit.3: ret void } -; VALUE: region: 'S1 => exit.3' in function 'sequential_writes': +; VALUE-LABEL: region: 'S1 => exit.3' in function 'sequential_writes': ; VALUE: RAW dependences: ; VALUE: { } ; VALUE: WAR dependences: @@ -62,7 +62,7 @@ exit.3: ; VALUE: Stmt_S1[i0] -> Stmt_S3[i0] : i0 >= 10 and i0 <= 99 ; VALUE: } -; MEMORY: region: 'S1 => exit.3' in function 'sequential_writes': +; MEMORY-LABEL: region: 'S1 => exit.3' in function 'sequential_writes': ; MEMORY: RAW dependences: ; MEMORY: { } ; MEMORY: WAR dependences: @@ -125,7 +125,7 @@ exit.3: ret void } -; VALUE: region: 'S1 => exit.3' in function 'read_after_writes': +; VALUE-LABEL: region: 'S1 => exit.3' in function 'read_after_writes': ; VALUE: RAW dependences: ; VALUE: { ; VALUE: Stmt_S2[i0] -> Stmt_S3[i0] : i0 >= 0 and i0 <= 9; @@ -135,10 +135,10 @@ exit.3: ; VALUE: { } ; VALUE: WAW dependences: ; VALUE: { -; VALUE: Stmt_S1[i0] -> Stmt_S2[i0] : i0 >= 0 and i0 <= 9 +; VALUE: Stmt_S1[i0] -> Stmt_S2[i0] : i0 <= 9 and i0 >= 0 ; VALUE: } -; MEMORY: region: 'S1 => exit.3' in function 'read_after_writes': +; MEMORY-LABEL: region: 'S1 => exit.3' in function 'read_after_writes': ; MEMORY: RAW dependences: ; MEMORY: { ; MEMORY: Stmt_S2[i0] -> Stmt_S3[i0] : i0 <= 9 and i0 >= 0; @@ -202,7 +202,7 @@ exit.3: ret void } -; VALUE: region: 'S1 => exit.3' in function 'write_after_read': +; VALUE-LABEL: region: 'S1 => exit.3' in function 'write_after_read': ; VALUE: RAW dependences: ; VALUE: { ; VALUE: } @@ -213,10 +213,10 @@ exit.3: ; VALUE: } ; VALUE: WAW dependences: ; VALUE: { -; VALUE: Stmt_S2[i0] -> Stmt_S3[i0] : i0 >= 0 and i0 <= 9 +; VALUE: Stmt_S2[i0] -> Stmt_S3[i0] : i0 <= 9 and i0 >= 0 ; VALUE: } -; MEMORY: region: 'S1 => exit.3' in function 'write_after_read': +; MEMORY-LABEL: region: 'S1 => exit.3' in function 'write_after_read': ; MEMORY: RAW dependences: ; MEMORY: { ; MEMORY: } |

