From b3706154514ee4cb432122f7f822ebecee97f688 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Fri, 6 Jul 2018 09:00:26 +0000 Subject: [PATCH] Update isl to isl-0.19-224-gce84a511 This is a maintenance update. Besides many minor changes it ships two functions "isl_*_list_size" and "isl_*_list_get_at" which will allow us to simplify the iterator implementation in Polly. llvm-svn: 336425 --- polly/lib/External/CMakeLists.txt | 1 + polly/lib/External/isl/GIT_HEAD_ID | 2 +- polly/lib/External/isl/Makefile.am | 1 + polly/lib/External/isl/Makefile.in | 50 ++-- polly/lib/External/isl/doc/user.pod | 59 ++++- polly/lib/External/isl/include/isl/ilp.h | 10 +- polly/lib/External/isl/include/isl/list.h | 8 + polly/lib/External/isl/include/isl/map.h | 2 +- polly/lib/External/isl/include/isl/set.h | 5 + polly/lib/External/isl/isl_aff.c | 285 +-------------------- polly/lib/External/isl/isl_coalesce.c | 8 +- polly/lib/External/isl/isl_ilp.c | 166 +++++++----- polly/lib/External/isl/isl_input.c | 11 +- polly/lib/External/isl/isl_list_templ.c | 48 +++- polly/lib/External/isl/isl_map.c | 177 +------------ polly/lib/External/isl/isl_map_private.h | 3 + polly/lib/External/isl/isl_map_subtract.c | 3 +- polly/lib/External/isl/isl_multi_templ.c | 3 +- polly/lib/External/isl/isl_multi_templ.h | 1 + polly/lib/External/isl/isl_test.c | 72 +++++- polly/lib/External/isl/isl_val.c | 16 +- polly/lib/External/isl/isl_val_private.h | 4 +- .../isl/test_inputs/codegen/cloog/classen.c | 127 ++++----- .../External/isl/test_inputs/codegen/correlation.c | 2 +- 24 files changed, 424 insertions(+), 640 deletions(-) diff --git a/polly/lib/External/CMakeLists.txt b/polly/lib/External/CMakeLists.txt index b44bca9..8ffd984 100644 --- a/polly/lib/External/CMakeLists.txt +++ b/polly/lib/External/CMakeLists.txt @@ -179,6 +179,7 @@ if (POLLY_BUNDLED_ISL) set (ISL_FILES isl/basis_reduction_tab.c isl/isl_aff.c + isl/isl_aff_map.c isl/isl_affine_hull.c isl/isl_arg.c isl/isl_ast_build.c diff --git a/polly/lib/External/isl/GIT_HEAD_ID b/polly/lib/External/isl/GIT_HEAD_ID index 1b53e17..b4b437e 100644 --- a/polly/lib/External/isl/GIT_HEAD_ID +++ b/polly/lib/External/isl/GIT_HEAD_ID @@ -1 +1 @@ -isl-0.19-185-g8e9f55ce +isl-0.19-224-gce84a511 diff --git a/polly/lib/External/isl/Makefile.am b/polly/lib/External/isl/Makefile.am index 7c33766..70d36f7 100644 --- a/polly/lib/External/isl/Makefile.am +++ b/polly/lib/External/isl/Makefile.am @@ -64,6 +64,7 @@ AM_CFLAGS = @WARNING_FLAGS@ libisl_la_SOURCES = \ $(MP_SRC) \ isl_aff.c \ + isl_aff_map.c \ isl_aff_private.h \ isl_affine_hull.c \ isl_arg.c \ diff --git a/polly/lib/External/isl/Makefile.in b/polly/lib/External/isl/Makefile.in index d44a0be..1b67097 100644 --- a/polly/lib/External/isl/Makefile.in +++ b/polly/lib/External/isl/Makefile.in @@ -178,8 +178,8 @@ am__libisl_la_SOURCES_DIST = mp_get_memory_functions.c isl_int_gmp.h \ imath_wrap/imrat.h imath_wrap/wrap.h imath_wrap/gmp_compat.c \ imath_wrap/imath.c imath_wrap/imrat.c isl_int_sioimath.h \ isl_int_sioimath.c isl_val_sioimath.c isl_val_imath.c \ - isl_aff.c isl_aff_private.h isl_affine_hull.c isl_arg.c \ - isl_ast.c isl_ast_private.h isl_ast_build.c \ + isl_aff.c isl_aff_map.c isl_aff_private.h isl_affine_hull.c \ + isl_arg.c isl_ast.c isl_ast_private.h isl_ast_build.c \ isl_ast_build_private.h isl_ast_build_expr.c \ isl_ast_build_expr.h isl_ast_codegen.c isl_ast_graft.c \ isl_ast_graft_private.h isl_basis_reduction.h \ @@ -229,28 +229,28 @@ am__dirstamp = $(am__leading_dot)dirstamp @GMP_FOR_MP_FALSE@@IMATH_FOR_MP_TRUE@ $(am__objects_3) @GMP_FOR_MP_TRUE@am__objects_4 = $(am__objects_1) isl_gmp.lo \ @GMP_FOR_MP_TRUE@ isl_val_gmp.lo -am_libisl_la_OBJECTS = $(am__objects_4) isl_aff.lo isl_affine_hull.lo \ - isl_arg.lo isl_ast.lo isl_ast_build.lo isl_ast_build_expr.lo \ - isl_ast_codegen.lo isl_ast_graft.lo basis_reduction_tab.lo \ - isl_bernstein.lo isl_blk.lo isl_bound.lo isl_box.lo \ - isl_coalesce.lo isl_constraint.lo isl_convex_hull.lo \ - isl_ctx.lo isl_deprecated.lo isl_dim_map.lo isl_equalities.lo \ - isl_factorization.lo isl_farkas.lo isl_ffs.lo isl_flow.lo \ - isl_fold.lo isl_hash.lo isl_id_to_ast_expr.lo isl_id_to_id.lo \ - isl_id_to_pw_aff.lo isl_ilp.lo isl_input.lo isl_local.lo \ - isl_local_space.lo isl_lp.lo isl_map.lo isl_map_list.lo \ - isl_map_simplify.lo isl_map_subtract.lo \ - isl_map_to_basic_set.lo isl_mat.lo isl_morph.lo isl_id.lo \ - isl_obj.lo isl_options.lo isl_output.lo isl_point.lo \ - isl_polynomial.lo isl_printer.lo print.lo isl_range.lo \ - isl_reordering.lo isl_sample.lo isl_scan.lo isl_schedule.lo \ - isl_schedule_band.lo isl_schedule_node.lo isl_schedule_read.lo \ - isl_schedule_tree.lo isl_schedule_constraints.lo \ - isl_scheduler.lo isl_set_list.lo isl_sort.lo isl_space.lo \ - isl_stream.lo isl_seq.lo isl_stride.lo isl_tab.lo \ - isl_tab_pip.lo isl_tarjan.lo isl_transitive_closure.lo \ - isl_union_map.lo isl_val.lo isl_vec.lo isl_version.lo \ - isl_vertices.lo +am_libisl_la_OBJECTS = $(am__objects_4) isl_aff.lo isl_aff_map.lo \ + isl_affine_hull.lo isl_arg.lo isl_ast.lo isl_ast_build.lo \ + isl_ast_build_expr.lo isl_ast_codegen.lo isl_ast_graft.lo \ + basis_reduction_tab.lo isl_bernstein.lo isl_blk.lo \ + isl_bound.lo isl_box.lo isl_coalesce.lo isl_constraint.lo \ + isl_convex_hull.lo isl_ctx.lo isl_deprecated.lo isl_dim_map.lo \ + isl_equalities.lo isl_factorization.lo isl_farkas.lo \ + isl_ffs.lo isl_flow.lo isl_fold.lo isl_hash.lo \ + isl_id_to_ast_expr.lo isl_id_to_id.lo isl_id_to_pw_aff.lo \ + isl_ilp.lo isl_input.lo isl_local.lo isl_local_space.lo \ + isl_lp.lo isl_map.lo isl_map_list.lo isl_map_simplify.lo \ + isl_map_subtract.lo isl_map_to_basic_set.lo isl_mat.lo \ + isl_morph.lo isl_id.lo isl_obj.lo isl_options.lo isl_output.lo \ + isl_point.lo isl_polynomial.lo isl_printer.lo print.lo \ + isl_range.lo isl_reordering.lo isl_sample.lo isl_scan.lo \ + isl_schedule.lo isl_schedule_band.lo isl_schedule_node.lo \ + isl_schedule_read.lo isl_schedule_tree.lo \ + isl_schedule_constraints.lo isl_scheduler.lo isl_set_list.lo \ + isl_sort.lo isl_space.lo isl_stream.lo isl_seq.lo \ + isl_stride.lo isl_tab.lo isl_tab_pip.lo isl_tarjan.lo \ + isl_transitive_closure.lo isl_union_map.lo isl_val.lo \ + isl_vec.lo isl_version.lo isl_vertices.lo libisl_la_OBJECTS = $(am_libisl_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -869,6 +869,7 @@ AM_CFLAGS = @WARNING_FLAGS@ libisl_la_SOURCES = \ $(MP_SRC) \ isl_aff.c \ + isl_aff_map.c \ isl_aff_private.h \ isl_affine_hull.c \ isl_arg.c \ @@ -1419,6 +1420,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flow_cmp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_aff.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_aff_map.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_affine_hull.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_arg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_ast.Plo@am__quote@ diff --git a/polly/lib/External/isl/doc/user.pod b/polly/lib/External/isl/doc/user.pod index 00fe4cf..5d23357 100644 --- a/polly/lib/External/isl/doc/user.pod +++ b/polly/lib/External/isl/doc/user.pod @@ -2096,14 +2096,17 @@ or a list of affine expressions (See L), provided these affine expressions do not involve any NaN. + #include + __isl_give isl_basic_set *isl_basic_set_from_multi_aff( + __isl_take isl_multi_aff *ma); + __isl_give isl_set *isl_set_from_multi_aff( + __isl_take isl_multi_aff *ma); + + #include __isl_give isl_basic_map *isl_basic_map_from_aff( __isl_take isl_aff *aff); __isl_give isl_map *isl_map_from_aff( __isl_take isl_aff *aff); - __isl_give isl_set *isl_set_from_pw_aff( - __isl_take isl_pw_aff *pwaff); - __isl_give isl_map *isl_map_from_pw_aff( - __isl_take isl_pw_aff *pwaff); __isl_give isl_basic_map *isl_basic_map_from_aff_list( __isl_take isl_space *domain_space, __isl_take isl_aff_list *list); @@ -2111,6 +2114,12 @@ involve any NaN. __isl_take isl_multi_aff *maff) __isl_give isl_map *isl_map_from_multi_aff( __isl_take isl_multi_aff *maff) + + #include + __isl_give isl_set *isl_set_from_pw_aff( + __isl_take isl_pw_aff *pwaff); + __isl_give isl_map *isl_map_from_pw_aff( + __isl_take isl_pw_aff *pwaff); __isl_give isl_set *isl_set_from_pw_multi_aff( __isl_take isl_pw_multi_aff *pma); __isl_give isl_map *isl_map_from_pw_multi_aff( @@ -4341,6 +4350,11 @@ return true if the objects are not the same. __isl_keep isl_union_map *umap1, __isl_keep isl_union_map *umap2); + #include + isl_bool isl_multi_val_plain_is_equal( + __isl_keep isl_multi_val *mv1, + __isl_keep isl_multi_val *mv2); + #include isl_bool isl_aff_plain_is_equal( __isl_keep isl_aff *aff1, @@ -5381,11 +5395,29 @@ a singleton subset of the input. Otherwise, return an empty set. __isl_keep isl_aff *obj); __isl_give isl_multi_val * isl_union_set_min_multi_union_pw_aff( - __isl_keep isl_union_set *set, + __isl_keep isl_union_set *uset, __isl_keep isl_multi_union_pw_aff *obj); Compute the minimum or maximum of the integer affine expression C -over the points in C, returning the result in C. +over the points in C. +The result is C in case of an error, the optimal value in case +there is one, negative infinity or infinity if the problem is unbounded and +NaN if the problem is empty. + + #include + __isl_give isl_val *isl_union_pw_aff_min_val( + __isl_take isl_union_pw_aff *upa); + __isl_give isl_val *isl_union_pw_aff_max_val( + __isl_take isl_union_pw_aff *upa); + __isl_give isl_multi_val * + isl_multi_union_pw_aff_min_multi_val( + __isl_take isl_multi_union_pw_aff *mupa); + __isl_give isl_multi_val * + isl_multi_union_pw_aff_max_multi_val( + __isl_take isl_multi_union_pw_aff *mupa); + +Compute the minimum or maximum of the integer affine expression +over its definition domain. The result is C in case of an error, the optimal value in case there is one, negative infinity or infinity if the problem is unbounded and NaN if the problem is empty. @@ -6904,7 +6936,7 @@ instead. #include __isl_give isl_multi_val *isl_multi_val_flat_range_product( __isl_take isl_multi_val *mv1, - __isl_take isl_multi_aff *mv2); + __isl_take isl_multi_val *mv2); #include __isl_give isl_multi_aff *isl_multi_aff_flat_range_product( @@ -7813,6 +7845,11 @@ Lists can be created, copied, modified and freed using the following functions. __isl_give isl_set_list *isl_set_list_drop( __isl_take isl_set_list *list, unsigned first, unsigned n); + __isl_give isl_set_list *isl_set_list_swap( + __isl_take isl_set_list *list, + unsigned pos1, unsigned pos2); + __isl_give isl_set_list *isl_set_list_reverse( + __isl_take isl_set_list *list); __isl_give isl_set_list *isl_set_list_set_set( __isl_take isl_set_list *list, int index, __isl_take isl_set *set); @@ -7836,11 +7873,16 @@ C creates an empty list with an initial capacity for C elements. C and C add elements to a list, increasing its capacity as needed. C creates a list with a single element. +C swaps the elements at the specified locations. +C reverses the elements in the list. Lists can be inspected using the following functions. #include + int isl_set_list_size(__isl_keep isl_set_list *list); int isl_set_list_n_set(__isl_keep isl_set_list *list); + __isl_give isl_set *isl_set_list_get_at( + __isl_keep isl_set_list *list, int index); __isl_give isl_set *isl_set_list_get_set( __isl_keep isl_set_list *list, int index); isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list, @@ -7854,6 +7896,9 @@ Lists can be inspected using the following functions. isl_stat (*fn)(__isl_take isl_set *el, void *user), void *fn_user); +C is an alternative name for C. +Similarly, +C is an alternative name for C. The function C calls C on each of the strongly connected components of the graph with as vertices the elements of C and a directed edge from vertex C to vertex C diff --git a/polly/lib/External/isl/include/isl/ilp.h b/polly/lib/External/isl/include/isl/ilp.h index db2ff38..0116642 100644 --- a/polly/lib/External/isl/include/isl/ilp.h +++ b/polly/lib/External/isl/include/isl/ilp.h @@ -29,7 +29,15 @@ __isl_export __isl_give isl_val *isl_set_max_val(__isl_keep isl_set *set, __isl_keep isl_aff *obj); __isl_give isl_multi_val *isl_union_set_min_multi_union_pw_aff( - __isl_keep isl_union_set *set, __isl_keep isl_multi_union_pw_aff *obj); + __isl_keep isl_union_set *uset, __isl_keep isl_multi_union_pw_aff *obj); + +__isl_give isl_val *isl_union_pw_aff_min_val(__isl_take isl_union_pw_aff *upa); +__isl_give isl_val *isl_union_pw_aff_max_val(__isl_take isl_union_pw_aff *upa); + +__isl_give isl_multi_val *isl_multi_union_pw_aff_min_multi_val( + __isl_take isl_multi_union_pw_aff *mupa); +__isl_give isl_multi_val *isl_multi_union_pw_aff_max_multi_val( + __isl_take isl_multi_union_pw_aff *mupa); __isl_export __isl_give isl_val *isl_basic_set_dim_max_val(__isl_take isl_basic_set *bset, diff --git a/polly/lib/External/isl/include/isl/list.h b/polly/lib/External/isl/include/isl/list.h index 803fd3a..49d2f91 100644 --- a/polly/lib/External/isl/include/isl/list.h +++ b/polly/lib/External/isl/include/isl/list.h @@ -38,10 +38,18 @@ __isl_give isl_##EL##_list *isl_##EL##_list_insert( \ __isl_take struct isl_##EL *el); \ __isl_give isl_##EL##_list *isl_##EL##_list_drop( \ __isl_take isl_##EL##_list *list, unsigned first, unsigned n); \ +__isl_give isl_##EL##_list *isl_##EL##_list_swap( \ + __isl_take isl_##EL##_list *list, unsigned pos1, \ + unsigned pos2); \ +__isl_give isl_##EL##_list *isl_##EL##_list_reverse( \ + __isl_take isl_##EL##_list *list); \ __isl_give isl_##EL##_list *isl_##EL##_list_concat( \ __isl_take isl_##EL##_list *list1, \ __isl_take isl_##EL##_list *list2); \ +int isl_##EL##_list_size(__isl_keep isl_##EL##_list *list); \ int isl_##EL##_list_n_##EL(__isl_keep isl_##EL##_list *list); \ +__isl_give isl_##EL *isl_##EL##_list_get_at( \ + __isl_keep isl_##EL##_list *list, int index); \ __isl_give struct isl_##EL *isl_##EL##_list_get_##EL( \ __isl_keep isl_##EL##_list *list, int index); \ __isl_give struct isl_##EL##_list *isl_##EL##_list_set_##EL( \ diff --git a/polly/lib/External/isl/include/isl/map.h b/polly/lib/External/isl/include/isl/map.h index 8b05ba9..f04fb26 100644 --- a/polly/lib/External/isl/include/isl/map.h +++ b/polly/lib/External/isl/include/isl/map.h @@ -669,7 +669,7 @@ __isl_give isl_basic_map *isl_basic_map_from_aff(__isl_take isl_aff *aff); __isl_give isl_basic_map *isl_basic_map_from_multi_aff( __isl_take isl_multi_aff *maff); __isl_give isl_basic_map *isl_basic_map_from_aff_list( - __isl_take isl_space *domain_dim, __isl_take isl_aff_list *list); + __isl_take isl_space *domain_space, __isl_take isl_aff_list *list); __isl_give isl_map *isl_map_from_aff(__isl_take isl_aff *aff); __isl_give isl_map *isl_map_from_multi_aff(__isl_take isl_multi_aff *maff); diff --git a/polly/lib/External/isl/include/isl/set.h b/polly/lib/External/isl/include/isl/set.h index 29fb84e..50c71d0 100644 --- a/polly/lib/External/isl/include/isl/set.h +++ b/polly/lib/External/isl/include/isl/set.h @@ -498,6 +498,11 @@ __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices( __isl_take isl_mat *eq, __isl_take isl_mat *ineq, enum isl_dim_type c1, enum isl_dim_type c2, enum isl_dim_type c3, enum isl_dim_type c4); +__isl_give isl_basic_set *isl_basic_set_from_multi_aff( + __isl_take isl_multi_aff *ma); + +__isl_give isl_set *isl_set_from_multi_aff(__isl_take isl_multi_aff *ma); + __isl_give isl_mat *isl_basic_set_reduced_basis(__isl_keep isl_basic_set *bset); __isl_give isl_basic_set *isl_basic_set_coefficients( diff --git a/polly/lib/External/isl/isl_aff.c b/polly/lib/External/isl/isl_aff.c index da28a65..c967277 100644 --- a/polly/lib/External/isl/isl_aff.c +++ b/polly/lib/External/isl/isl_aff.c @@ -2803,70 +2803,6 @@ __isl_give isl_pw_aff *isl_pw_aff_union_opt(__isl_take isl_pw_aff *pwaff1, return isl_pw_aff_union_min(pwaff1, pwaff2); } -/* Construct a map with as domain the domain of pwaff and - * one-dimensional range corresponding to the affine expressions. - */ -static __isl_give isl_map *map_from_pw_aff(__isl_take isl_pw_aff *pwaff) -{ - int i; - isl_space *dim; - isl_map *map; - - if (!pwaff) - return NULL; - - dim = isl_pw_aff_get_space(pwaff); - map = isl_map_empty(dim); - - for (i = 0; i < pwaff->n; ++i) { - isl_basic_map *bmap; - isl_map *map_i; - - bmap = isl_basic_map_from_aff(isl_aff_copy(pwaff->p[i].aff)); - map_i = isl_map_from_basic_map(bmap); - map_i = isl_map_intersect_domain(map_i, - isl_set_copy(pwaff->p[i].set)); - map = isl_map_union_disjoint(map, map_i); - } - - isl_pw_aff_free(pwaff); - - return map; -} - -/* Construct a map with as domain the domain of pwaff and - * one-dimensional range corresponding to the affine expressions. - */ -__isl_give isl_map *isl_map_from_pw_aff(__isl_take isl_pw_aff *pwaff) -{ - if (!pwaff) - return NULL; - if (isl_space_is_set(pwaff->dim)) - isl_die(isl_pw_aff_get_ctx(pwaff), isl_error_invalid, - "space of input is not a map", goto error); - return map_from_pw_aff(pwaff); -error: - isl_pw_aff_free(pwaff); - return NULL; -} - -/* Construct a one-dimensional set with as parameter domain - * the domain of pwaff and the single set dimension - * corresponding to the affine expressions. - */ -__isl_give isl_set *isl_set_from_pw_aff(__isl_take isl_pw_aff *pwaff) -{ - if (!pwaff) - return NULL; - if (!isl_space_is_set(pwaff->dim)) - isl_die(isl_pw_aff_get_ctx(pwaff), isl_error_invalid, - "space of input is not a set", goto error); - return map_from_pw_aff(pwaff); -error: - isl_pw_aff_free(pwaff); - return NULL; -} - /* Return a set containing those elements in the domain * of "pwaff" where it satisfies "fn" (if complement is 0) or * does not satisfy "fn" (if complement is 1). @@ -4238,8 +4174,8 @@ static __isl_give isl_set *isl_multi_aff_order_set( isl_map *map1, *map2; isl_map *map, *ge; - map1 = isl_map_from_multi_aff(ma1); - map2 = isl_map_from_multi_aff(ma2); + map1 = isl_map_from_multi_aff_internal(ma1); + map2 = isl_map_from_multi_aff_internal(ma2); map = isl_map_range_product(map1, map2); space = isl_space_range(isl_map_get_space(map)); space = isl_space_domain(isl_space_unwrap(space)); @@ -4448,59 +4384,6 @@ __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product( &pw_multi_aff_product); } -/* Construct a map mapping the domain of the piecewise multi-affine expression - * to its range, with each dimension in the range equated to the - * corresponding affine expression on its cell. - * - * If the domain of "pma" is rational, then so is the constructed "map". - */ -__isl_give isl_map *isl_map_from_pw_multi_aff(__isl_take isl_pw_multi_aff *pma) -{ - int i; - isl_map *map; - - if (!pma) - return NULL; - - map = isl_map_empty(isl_pw_multi_aff_get_space(pma)); - - for (i = 0; i < pma->n; ++i) { - isl_bool rational; - isl_multi_aff *maff; - isl_basic_map *bmap; - isl_map *map_i; - - rational = isl_set_is_rational(pma->p[i].set); - if (rational < 0) - map = isl_map_free(map); - maff = isl_multi_aff_copy(pma->p[i].maff); - bmap = isl_basic_map_from_multi_aff2(maff, rational); - map_i = isl_map_from_basic_map(bmap); - map_i = isl_map_intersect_domain(map_i, - isl_set_copy(pma->p[i].set)); - map = isl_map_union_disjoint(map, map_i); - } - - isl_pw_multi_aff_free(pma); - return map; -} - -__isl_give isl_set *isl_set_from_pw_multi_aff(__isl_take isl_pw_multi_aff *pma) -{ - if (!pma) - return NULL; - - if (!isl_space_is_set(pma->dim)) - isl_die(isl_pw_multi_aff_get_ctx(pma), isl_error_invalid, - "isl_pw_multi_aff cannot be converted into an isl_set", - goto error); - - return isl_map_from_pw_multi_aff(pma); -error: - isl_pw_multi_aff_free(pma); - return NULL; -} - /* Subtract the initial "n" elements in "ma" with coefficients in "c" and * denominator "denom". * "denom" is allowed to be negative, in which case the actual denominator @@ -4878,7 +4761,7 @@ static __isl_give isl_pw_multi_aff *pw_multi_aff_from_map_div( isl_multi_aff_from_aff(aff)); } - insert = isl_map_from_multi_aff(isl_multi_aff_copy(ma)); + insert = isl_map_from_multi_aff_internal(isl_multi_aff_copy(ma)); map = isl_map_apply_domain(map, insert); map = isl_map_equate(map, isl_dim_in, n_in, isl_dim_out, d); pma = isl_pw_multi_aff_from_map(map); @@ -5987,48 +5870,6 @@ error: return NULL; } -/* Convert "pma" to an isl_map and add it to *umap. - */ -static isl_stat map_from_pw_multi_aff(__isl_take isl_pw_multi_aff *pma, - void *user) -{ - isl_union_map **umap = user; - isl_map *map; - - map = isl_map_from_pw_multi_aff(pma); - *umap = isl_union_map_add_map(*umap, map); - - return isl_stat_ok; -} - -/* Construct a union map mapping the domain of the union - * piecewise multi-affine expression to its range, with each dimension - * in the range equated to the corresponding affine expression on its cell. - */ -__isl_give isl_union_map *isl_union_map_from_union_pw_multi_aff( - __isl_take isl_union_pw_multi_aff *upma) -{ - isl_space *space; - isl_union_map *umap; - - if (!upma) - return NULL; - - space = isl_union_pw_multi_aff_get_space(upma); - umap = isl_union_map_empty(space); - - if (isl_union_pw_multi_aff_foreach_pw_multi_aff(upma, - &map_from_pw_multi_aff, &umap) < 0) - goto error; - - isl_union_pw_multi_aff_free(upma); - return umap; -error: - isl_union_pw_multi_aff_free(upma); - isl_union_map_free(umap); - return NULL; -} - /* Local data for bin_entry and the callback "fn". */ struct isl_union_pw_multi_aff_bin_data { @@ -6470,85 +6311,6 @@ __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff( return pma; } -/* Construct a set or map mapping the shared (parameter) domain - * of the piecewise affine expressions to the range of "mpa" - * with each dimension in the range equated to the - * corresponding piecewise affine expression. - */ -static __isl_give isl_map *map_from_multi_pw_aff( - __isl_take isl_multi_pw_aff *mpa) -{ - int i; - isl_space *space; - isl_map *map; - - if (!mpa) - return NULL; - - if (isl_space_dim(mpa->space, isl_dim_out) != mpa->n) - isl_die(isl_multi_pw_aff_get_ctx(mpa), isl_error_internal, - "invalid space", goto error); - - space = isl_multi_pw_aff_get_domain_space(mpa); - map = isl_map_universe(isl_space_from_domain(space)); - - for (i = 0; i < mpa->n; ++i) { - isl_pw_aff *pa; - isl_map *map_i; - - pa = isl_pw_aff_copy(mpa->u.p[i]); - map_i = map_from_pw_aff(pa); - - map = isl_map_flat_range_product(map, map_i); - } - - map = isl_map_reset_space(map, isl_multi_pw_aff_get_space(mpa)); - - isl_multi_pw_aff_free(mpa); - return map; -error: - isl_multi_pw_aff_free(mpa); - return NULL; -} - -/* Construct a map mapping the shared domain - * of the piecewise affine expressions to the range of "mpa" - * with each dimension in the range equated to the - * corresponding piecewise affine expression. - */ -__isl_give isl_map *isl_map_from_multi_pw_aff(__isl_take isl_multi_pw_aff *mpa) -{ - if (!mpa) - return NULL; - if (isl_space_is_set(mpa->space)) - isl_die(isl_multi_pw_aff_get_ctx(mpa), isl_error_internal, - "space of input is not a map", goto error); - - return map_from_multi_pw_aff(mpa); -error: - isl_multi_pw_aff_free(mpa); - return NULL; -} - -/* Construct a set mapping the shared parameter domain - * of the piecewise affine expressions to the space of "mpa" - * with each dimension in the range equated to the - * corresponding piecewise affine expression. - */ -__isl_give isl_set *isl_set_from_multi_pw_aff(__isl_take isl_multi_pw_aff *mpa) -{ - if (!mpa) - return NULL; - if (!isl_space_is_set(mpa->space)) - isl_die(isl_multi_pw_aff_get_ctx(mpa), isl_error_internal, - "space of input is not a set", goto error); - - return map_from_multi_pw_aff(mpa); -error: - isl_multi_pw_aff_free(mpa); - return NULL; -} - /* Construct and return a piecewise multi affine expression * that is equal to the given multi piecewise affine expression * on the shared domain of the piecewise affine expressions, @@ -6700,8 +6462,8 @@ isl_bool isl_pw_aff_is_equal(__isl_keep isl_pw_aff *pa1, if (has_nan) return isl_bool_false; - map1 = map_from_pw_aff(isl_pw_aff_copy(pa1)); - map2 = map_from_pw_aff(isl_pw_aff_copy(pa2)); + map1 = isl_map_from_pw_aff_internal(isl_pw_aff_copy(pa1)); + map2 = isl_map_from_pw_aff_internal(isl_pw_aff_copy(pa2)); equal = isl_map_is_equal(map1, map2); isl_map_free(map1); isl_map_free(map2); @@ -8053,43 +7815,6 @@ __isl_give isl_union_set *isl_union_pw_aff_zero_union_set( return zero; } -/* Convert "pa" to an isl_map and add it to *umap. - */ -static isl_stat map_from_pw_aff_entry(__isl_take isl_pw_aff *pa, void *user) -{ - isl_union_map **umap = user; - isl_map *map; - - map = isl_map_from_pw_aff(pa); - *umap = isl_union_map_add_map(*umap, map); - - return *umap ? isl_stat_ok : isl_stat_error; -} - -/* Construct a union map mapping the domain of the union - * piecewise affine expression to its range, with the single output dimension - * equated to the corresponding affine expressions on their cells. - */ -__isl_give isl_union_map *isl_union_map_from_union_pw_aff( - __isl_take isl_union_pw_aff *upa) -{ - isl_space *space; - isl_union_map *umap; - - if (!upa) - return NULL; - - space = isl_union_pw_aff_get_space(upa); - umap = isl_union_map_empty(space); - - if (isl_union_pw_aff_foreach_pw_aff(upa, &map_from_pw_aff_entry, - &umap) < 0) - umap = isl_union_map_free(umap); - - isl_union_pw_aff_free(upa); - return umap; -} - /* Internal data structure for isl_union_pw_aff_pullback_union_pw_multi_aff. * upma is the function that is plugged in. * pa is the current part of the function in which upma is plugged in. diff --git a/polly/lib/External/isl/isl_coalesce.c b/polly/lib/External/isl/isl_coalesce.c index 01fc7cd..748d2f9 100644 --- a/polly/lib/External/isl/isl_coalesce.c +++ b/polly/lib/External/isl/isl_coalesce.c @@ -3134,7 +3134,7 @@ static enum isl_change coalesce_after_aligning_divs( __isl_keep isl_basic_map *bmap_i, int i, int j, struct isl_coalesce_info *info) { - int known; + isl_bool known; isl_mat *div_i, *div_j, *div; int *exp1 = NULL; int *exp2 = NULL; @@ -3142,8 +3142,10 @@ static enum isl_change coalesce_after_aligning_divs( enum isl_change change; known = isl_basic_map_divs_known(bmap_i); - if (known < 0 || !known) - return known; + if (known < 0) + return isl_change_error; + if (!known) + return isl_change_none; ctx = isl_basic_map_get_ctx(bmap_i); diff --git a/polly/lib/External/isl/isl_ilp.c b/polly/lib/External/isl/isl_ilp.c index d517290..fb2cda1 100644 --- a/polly/lib/External/isl/isl_ilp.c +++ b/polly/lib/External/isl/isl_ilp.c @@ -651,15 +651,13 @@ error: return NULL; } -/* Internal data structure for isl_set_opt_pw_aff. +/* Internal data structure for isl_pw_aff_opt_val. * * "max" is set if the maximum should be computed. - * "set" is the set over which the optimum should be computed. * "res" contains the current optimum and is initialized to NaN. */ -struct isl_set_opt_data { +struct isl_pw_aff_opt_data { int max; - isl_set *set; isl_val *res; }; @@ -670,10 +668,9 @@ struct isl_set_opt_data { static isl_stat piece_opt(__isl_take isl_set *set, __isl_take isl_aff *aff, void *user) { - struct isl_set_opt_data *data = user; + struct isl_pw_aff_opt_data *data = user; isl_val *opt; - set = isl_set_intersect(set, isl_set_copy(data->set)); opt = isl_set_opt_val(set, data->max, aff); isl_set_free(set); isl_aff_free(aff); @@ -686,57 +683,46 @@ static isl_stat piece_opt(__isl_take isl_set *set, __isl_take isl_aff *aff, } /* Return the minimum (maximum if "max" is set) of the integer piecewise affine - * expression "obj" over the points in "set". + * expression "pa" over its definition domain. * * Return infinity or negative infinity if the optimal value is unbounded and - * NaN if the intersection of "set" with the domain of "obj" is empty. + * NaN if the domain of "pa" is empty. * * Initialize the result to NaN and then update it for each of the pieces - * in "obj". + * in "pa". */ -static __isl_give isl_val *isl_set_opt_pw_aff(__isl_keep isl_set *set, int max, - __isl_keep isl_pw_aff *obj) +static __isl_give isl_val *isl_pw_aff_opt_val(__isl_take isl_pw_aff *pa, + int max) { - struct isl_set_opt_data data = { max, set }; + struct isl_pw_aff_opt_data data = { max }; - data.res = isl_val_nan(isl_set_get_ctx(set)); - if (isl_pw_aff_foreach_piece(obj, &piece_opt, &data) < 0) - return isl_val_free(data.res); + data.res = isl_val_nan(isl_pw_aff_get_ctx(pa)); + if (isl_pw_aff_foreach_piece(pa, &piece_opt, &data) < 0) + data.res = isl_val_free(data.res); + isl_pw_aff_free(pa); return data.res; } -/* Internal data structure for isl_union_set_opt_union_pw_aff. +/* Internal data structure for isl_union_pw_aff_opt_val. * * "max" is set if the maximum should be computed. - * "obj" is the objective function that needs to be optimized. * "res" contains the current optimum and is initialized to NaN. */ -struct isl_union_set_opt_data { +struct isl_union_pw_aff_opt_data { int max; - isl_union_pw_aff *obj; isl_val *res; }; -/* Update the optimum in data->res with the optimum over "set". - * Do so by first extracting the matching objective function - * from data->obj. +/* Update the optimum in data->res with the optimum of "pa". */ -static isl_stat set_opt(__isl_take isl_set *set, void *user) +static isl_stat pw_aff_opt(__isl_take isl_pw_aff *pa, void *user) { - struct isl_union_set_opt_data *data = user; - isl_space *space; - isl_pw_aff *pa; + struct isl_union_pw_aff_opt_data *data = user; isl_val *opt; - space = isl_set_get_space(set); - space = isl_space_from_domain(space); - space = isl_space_add_dims(space, isl_dim_out, 1); - pa = isl_union_pw_aff_extract_pw_aff(data->obj, space); - opt = isl_set_opt_pw_aff(set, data->max, pa); - isl_pw_aff_free(pa); - isl_set_free(set); + opt = isl_pw_aff_opt_val(pa, data->max); data->res = val_opt(data->res, opt, data->max); if (!data->res) @@ -746,63 +732,101 @@ static isl_stat set_opt(__isl_take isl_set *set, void *user) } /* Return the minimum (maximum if "max" is set) of the integer piecewise affine - * expression "obj" over the points in "uset". + * expression "upa" over its definition domain. * * Return infinity or negative infinity if the optimal value is unbounded and - * NaN if the intersection of "uset" with the domain of "obj" is empty. + * NaN if the domain of the expression is empty. * - * Initialize the result to NaN and then update it for each of the sets - * in "uset". + * Initialize the result to NaN and then update it + * for each of the piecewise affine expressions in "upa". */ -static __isl_give isl_val *isl_union_set_opt_union_pw_aff( - __isl_keep isl_union_set *uset, int max, - __isl_keep isl_union_pw_aff *obj) +static __isl_give isl_val *isl_union_pw_aff_opt_val( + __isl_take isl_union_pw_aff *upa, int max) { - struct isl_union_set_opt_data data = { max, obj }; + struct isl_union_pw_aff_opt_data data = { max }; - data.res = isl_val_nan(isl_union_set_get_ctx(uset)); - if (isl_union_set_foreach_set(uset, &set_opt, &data) < 0) - return isl_val_free(data.res); + data.res = isl_val_nan(isl_union_pw_aff_get_ctx(upa)); + if (isl_union_pw_aff_foreach_pw_aff(upa, &pw_aff_opt, &data) < 0) + data.res = isl_val_free(data.res); + isl_union_pw_aff_free(upa); return data.res; } -/* Return a list of minima (maxima if "max" is set) over the points in "uset" - * for each of the expressions in "obj". +/* Return the minimum of the integer piecewise affine + * expression "upa" over its definition domain. + * + * Return negative infinity if the optimal value is unbounded and + * NaN if the domain of the expression is empty. + */ +__isl_give isl_val *isl_union_pw_aff_min_val(__isl_take isl_union_pw_aff *upa) +{ + return isl_union_pw_aff_opt_val(upa, 0); +} + +/* Return the maximum of the integer piecewise affine + * expression "upa" over its definition domain. + * + * Return infinity if the optimal value is unbounded and + * NaN if the domain of the expression is empty. + */ +__isl_give isl_val *isl_union_pw_aff_max_val(__isl_take isl_union_pw_aff *upa) +{ + return isl_union_pw_aff_opt_val(upa, 1); +} + +/* Return a list of minima (maxima if "max" is set) + * for each of the expressions in "mupa" over their domains. * * An element in the list is infinity or negative infinity if the optimal * value of the corresponding expression is unbounded and - * NaN if the intersection of "uset" with the domain of the expression - * is empty. + * NaN if the domain of the expression is empty. * - * Iterate over all the expressions in "obj" and collect the results. + * Iterate over all the expressions in "mupa" and collect the results. */ -static __isl_give isl_multi_val *isl_union_set_opt_multi_union_pw_aff( - __isl_keep isl_union_set *uset, int max, - __isl_keep isl_multi_union_pw_aff *obj) +static __isl_give isl_multi_val *isl_multi_union_pw_aff_opt_multi_val( + __isl_take isl_multi_union_pw_aff *mupa, int max) { int i, n; isl_multi_val *mv; - if (!uset || !obj) + if (!mupa) return NULL; - n = isl_multi_union_pw_aff_dim(obj, isl_dim_set); - mv = isl_multi_val_zero(isl_multi_union_pw_aff_get_space(obj)); + n = isl_multi_union_pw_aff_dim(mupa, isl_dim_set); + mv = isl_multi_val_zero(isl_multi_union_pw_aff_get_space(mupa)); for (i = 0; i < n; ++i) { isl_val *v; isl_union_pw_aff *upa; - upa = isl_multi_union_pw_aff_get_union_pw_aff(obj, i); - v = isl_union_set_opt_union_pw_aff(uset, max, upa); - isl_union_pw_aff_free(upa); + upa = isl_multi_union_pw_aff_get_union_pw_aff(mupa, i); + v = isl_union_pw_aff_opt_val(upa, max); mv = isl_multi_val_set_val(mv, i, v); } + isl_multi_union_pw_aff_free(mupa); return mv; } +/* Return a list of minima (maxima if "max" is set) over the points in "uset" + * for each of the expressions in "obj". + * + * An element in the list is infinity or negative infinity if the optimal + * value of the corresponding expression is unbounded and + * NaN if the intersection of "uset" with the domain of the expression + * is empty. + */ +static __isl_give isl_multi_val *isl_union_set_opt_multi_union_pw_aff( + __isl_keep isl_union_set *uset, int max, + __isl_keep isl_multi_union_pw_aff *obj) +{ + uset = isl_union_set_copy(uset); + obj = isl_multi_union_pw_aff_copy(obj); + obj = isl_multi_union_pw_aff_intersect_domain(obj, uset); + return isl_multi_union_pw_aff_opt_multi_val(obj, max); +} + /* Return a list of minima over the points in "uset" * for each of the expressions in "obj". * @@ -817,6 +841,32 @@ __isl_give isl_multi_val *isl_union_set_min_multi_union_pw_aff( return isl_union_set_opt_multi_union_pw_aff(uset, 0, obj); } +/* Return a list of minima + * for each of the expressions in "mupa" over their domains. + * + * An element in the list is negative infinity if the optimal + * value of the corresponding expression is unbounded and + * NaN if the domain of the expression is empty. + */ +__isl_give isl_multi_val *isl_multi_union_pw_aff_min_multi_val( + __isl_take isl_multi_union_pw_aff *mupa) +{ + return isl_multi_union_pw_aff_opt_multi_val(mupa, 0); +} + +/* Return a list of maxima + * for each of the expressions in "mupa" over their domains. + * + * An element in the list is infinity if the optimal + * value of the corresponding expression is unbounded and + * NaN if the domain of the expression is empty. + */ +__isl_give isl_multi_val *isl_multi_union_pw_aff_max_multi_val( + __isl_take isl_multi_union_pw_aff *mupa) +{ + return isl_multi_union_pw_aff_opt_multi_val(mupa, 1); +} + /* Return the maximal value attained by the given set dimension, * independently of the parameter values and of any other dimensions. * diff --git a/polly/lib/External/isl/isl_input.c b/polly/lib/External/isl/isl_input.c index ea0fa71..950b40e 100644 --- a/polly/lib/External/isl/isl_input.c +++ b/polly/lib/External/isl/isl_input.c @@ -2461,6 +2461,8 @@ error: static struct isl_obj obj_add(__isl_keep isl_stream *s, struct isl_obj obj1, struct isl_obj obj2) { + if (obj2.type == isl_obj_none || !obj2.v) + goto error; if (obj1.type == isl_obj_set && obj2.type == isl_obj_union_set) obj1 = to_union(s->ctx, obj1); if (obj1.type == isl_obj_union_set && obj2.type == isl_obj_set) @@ -2600,15 +2602,12 @@ static struct isl_obj obj_read_disjuncts(__isl_keep isl_stream *s, for (;;) { struct isl_obj o; o = obj_read_body(s, isl_map_copy(map), v); - if (o.type == isl_obj_none || !o.v) - return o; if (!obj.v) obj = o; - else { + else obj = obj_add(s, obj, o); - if (obj.type == isl_obj_none || !obj.v) - return obj; - } + if (obj.type == isl_obj_none || !obj.v) + return obj; if (!isl_stream_eat_if_available(s, ';')) break; if (isl_stream_next_token_is(s, '}')) diff --git a/polly/lib/External/isl/isl_list_templ.c b/polly/lib/External/isl/isl_list_templ.c index b6bd89a..edd6241 100644 --- a/polly/lib/External/isl/isl_list_templ.c +++ b/polly/lib/External/isl/isl_list_templ.c @@ -246,11 +246,20 @@ __isl_null LIST(EL) *FN(LIST(EL),free)(__isl_take LIST(EL) *list) return NULL; } -int FN(FN(LIST(EL),n),BASE)(__isl_keep LIST(EL) *list) +/* Return the number of elements in "list". + */ +int FN(LIST(EL),size)(__isl_keep LIST(EL) *list) { return list ? list->n : 0; } +/* This is an alternative name for the function above. + */ +int FN(FN(LIST(EL),n),BASE)(__isl_keep LIST(EL) *list) +{ + return FN(LIST(EL),size)(list); +} + /* Return the element at position "index" in "list". */ static __isl_keep EL *FN(LIST(EL),peek)(__isl_keep LIST(EL) *list, int index) @@ -262,11 +271,18 @@ static __isl_keep EL *FN(LIST(EL),peek)(__isl_keep LIST(EL) *list, int index) /* Return a copy of the element at position "index" in "list". */ -__isl_give EL *FN(FN(LIST(EL),get),BASE)(__isl_keep LIST(EL) *list, int index) +__isl_give EL *FN(LIST(EL),get_at)(__isl_keep LIST(EL) *list, int index) { return FN(EL,copy)(FN(LIST(EL),peek)(list, index)); } +/* This is an alternative name for the function above. + */ +__isl_give EL *FN(FN(LIST(EL),get),BASE)(__isl_keep LIST(EL) *list, int index) +{ + return FN(LIST(EL),get_at)(list, index); +} + /* Replace the element at position "index" in "list" by "el". */ __isl_give LIST(EL) *FN(FN(LIST(EL),set),BASE)(__isl_take LIST(EL) *list, @@ -326,6 +342,34 @@ static __isl_give LIST(EL) *FN(FN(LIST(EL),restore),BASE)( return FN(FN(LIST(EL),set),BASE)(list, index, el); } +/* Swap the elements of "list" in positions "pos1" and "pos2". + */ +__isl_give LIST(EL) *FN(LIST(EL),swap)(__isl_take LIST(EL) *list, + unsigned pos1, unsigned pos2) +{ + EL *el1, *el2; + + if (pos1 == pos2) + return list; + el1 = FN(FN(LIST(EL),take),BASE)(list, pos1); + el2 = FN(FN(LIST(EL),take),BASE)(list, pos2); + list = FN(FN(LIST(EL),restore),BASE)(list, pos1, el2); + list = FN(FN(LIST(EL),restore),BASE)(list, pos2, el1); + return list; +} + +/* Reverse the elements of "list". + */ +__isl_give LIST(EL) *FN(LIST(EL),reverse)(__isl_take LIST(EL) *list) +{ + int i, n; + + n = FN(LIST(EL),size)(list); + for (i = 0; i < n - 1 - i; ++i) + list = FN(LIST(EL),swap)(list, i, n - 1 - i); + return list; +} + isl_stat FN(LIST(EL),foreach)(__isl_keep LIST(EL) *list, isl_stat (*fn)(__isl_take EL *el, void *user), void *user) { diff --git a/polly/lib/External/isl/isl_map.c b/polly/lib/External/isl/isl_map.c index c3d7adb..40718b1 100644 --- a/polly/lib/External/isl/isl_map.c +++ b/polly/lib/External/isl/isl_map.c @@ -3707,6 +3707,7 @@ static __isl_give isl_map *map_intersect_add_constraint( isl_map_free(map2); + map1 = isl_map_unmark_normalized(map1); return map1; error: isl_map_free(map1); @@ -3721,6 +3722,7 @@ static __isl_give isl_map *map_intersect_internal(__isl_take isl_map *map1, __isl_take isl_map *map2) { unsigned flags = 0; + isl_bool equal; isl_map *result; int i, j; @@ -3747,6 +3749,14 @@ static __isl_give isl_map *map_intersect_internal(__isl_take isl_map *map1, map2->p[0]->n_eq + map2->p[0]->n_ineq == 1)) return map_intersect_add_constraint(map1, map2); + equal = isl_map_plain_is_equal(map1, map2); + if (equal < 0) + goto error; + if (equal) { + isl_map_free(map2); + return map1; + } + if (isl_space_dim(map2->dim, isl_dim_all) != isl_space_dim(map2->dim, isl_dim_param)) isl_assert(map1->ctx, @@ -12297,173 +12307,6 @@ __isl_give isl_map *isl_map_uncurry(__isl_take isl_map *map) "map cannot be uncurried", &isl_space_uncurry); } -/* Construct a basic map mapping the domain of the affine expression - * to a one-dimensional range prescribed by the affine expression. - * If "rational" is set, then construct a rational basic map. - * - * A NaN affine expression cannot be converted to a basic map. - */ -static __isl_give isl_basic_map *isl_basic_map_from_aff2( - __isl_take isl_aff *aff, int rational) -{ - int k; - int pos; - isl_bool is_nan; - isl_local_space *ls; - isl_basic_map *bmap = NULL; - - if (!aff) - return NULL; - is_nan = isl_aff_is_nan(aff); - if (is_nan < 0) - goto error; - if (is_nan) - isl_die(isl_aff_get_ctx(aff), isl_error_invalid, - "cannot convert NaN", goto error); - - ls = isl_aff_get_local_space(aff); - bmap = isl_basic_map_from_local_space(ls); - bmap = isl_basic_map_extend_constraints(bmap, 1, 0); - k = isl_basic_map_alloc_equality(bmap); - if (k < 0) - goto error; - - pos = isl_basic_map_offset(bmap, isl_dim_out); - isl_seq_cpy(bmap->eq[k], aff->v->el + 1, pos); - isl_int_neg(bmap->eq[k][pos], aff->v->el[0]); - isl_seq_cpy(bmap->eq[k] + pos + 1, aff->v->el + 1 + pos, - aff->v->size - (pos + 1)); - - isl_aff_free(aff); - if (rational) - bmap = isl_basic_map_set_rational(bmap); - bmap = isl_basic_map_gauss(bmap, NULL); - bmap = isl_basic_map_finalize(bmap); - return bmap; -error: - isl_aff_free(aff); - isl_basic_map_free(bmap); - return NULL; -} - -/* Construct a basic map mapping the domain of the affine expression - * to a one-dimensional range prescribed by the affine expression. - */ -__isl_give isl_basic_map *isl_basic_map_from_aff(__isl_take isl_aff *aff) -{ - return isl_basic_map_from_aff2(aff, 0); -} - -/* Construct a map mapping the domain of the affine expression - * to a one-dimensional range prescribed by the affine expression. - */ -__isl_give isl_map *isl_map_from_aff(__isl_take isl_aff *aff) -{ - isl_basic_map *bmap; - - bmap = isl_basic_map_from_aff(aff); - return isl_map_from_basic_map(bmap); -} - -/* Construct a basic map mapping the domain the multi-affine expression - * to its range, with each dimension in the range equated to the - * corresponding affine expression. - * If "rational" is set, then construct a rational basic map. - */ -__isl_give isl_basic_map *isl_basic_map_from_multi_aff2( - __isl_take isl_multi_aff *maff, int rational) -{ - int i; - isl_space *space; - isl_basic_map *bmap; - - if (!maff) - return NULL; - - if (isl_space_dim(maff->space, isl_dim_out) != maff->n) - isl_die(isl_multi_aff_get_ctx(maff), isl_error_internal, - "invalid space", goto error); - - space = isl_space_domain(isl_multi_aff_get_space(maff)); - bmap = isl_basic_map_universe(isl_space_from_domain(space)); - if (rational) - bmap = isl_basic_map_set_rational(bmap); - - for (i = 0; i < maff->n; ++i) { - isl_aff *aff; - isl_basic_map *bmap_i; - - aff = isl_aff_copy(maff->u.p[i]); - bmap_i = isl_basic_map_from_aff2(aff, rational); - - bmap = isl_basic_map_flat_range_product(bmap, bmap_i); - } - - bmap = isl_basic_map_reset_space(bmap, isl_multi_aff_get_space(maff)); - - isl_multi_aff_free(maff); - return bmap; -error: - isl_multi_aff_free(maff); - return NULL; -} - -/* Construct a basic map mapping the domain the multi-affine expression - * to its range, with each dimension in the range equated to the - * corresponding affine expression. - */ -__isl_give isl_basic_map *isl_basic_map_from_multi_aff( - __isl_take isl_multi_aff *ma) -{ - return isl_basic_map_from_multi_aff2(ma, 0); -} - -/* Construct a map mapping the domain the multi-affine expression - * to its range, with each dimension in the range equated to the - * corresponding affine expression. - */ -__isl_give isl_map *isl_map_from_multi_aff(__isl_take isl_multi_aff *maff) -{ - isl_basic_map *bmap; - - bmap = isl_basic_map_from_multi_aff(maff); - return isl_map_from_basic_map(bmap); -} - -/* Construct a basic map mapping a domain in the given space to - * to an n-dimensional range, with n the number of elements in the list, - * where each coordinate in the range is prescribed by the - * corresponding affine expression. - * The domains of all affine expressions in the list are assumed to match - * domain_dim. - */ -__isl_give isl_basic_map *isl_basic_map_from_aff_list( - __isl_take isl_space *domain_dim, __isl_take isl_aff_list *list) -{ - int i; - isl_space *dim; - isl_basic_map *bmap; - - if (!list) - return NULL; - - dim = isl_space_from_domain(domain_dim); - bmap = isl_basic_map_universe(dim); - - for (i = 0; i < list->n; ++i) { - isl_aff *aff; - isl_basic_map *bmap_i; - - aff = isl_aff_copy(list->p[i]); - bmap_i = isl_basic_map_from_aff(aff); - - bmap = isl_basic_map_flat_range_product(bmap, bmap_i); - } - - isl_aff_list_free(list); - return bmap; -} - __isl_give isl_set *isl_set_equate(__isl_take isl_set *set, enum isl_dim_type type1, int pos1, enum isl_dim_type type2, int pos2) { diff --git a/polly/lib/External/isl/isl_map_private.h b/polly/lib/External/isl/isl_map_private.h index bccafd5..1fbb6dc 100644 --- a/polly/lib/External/isl/isl_map_private.h +++ b/polly/lib/External/isl/isl_map_private.h @@ -393,6 +393,9 @@ isl_bool isl_set_has_rational(__isl_keep isl_set *set); __isl_give isl_basic_map *isl_basic_map_from_multi_aff2( __isl_take isl_multi_aff *maff, int rational); +__isl_give isl_map *isl_map_from_multi_aff_internal( + __isl_take isl_multi_aff *ma); +__isl_give isl_map *isl_map_from_pw_aff_internal(__isl_take isl_pw_aff *pa); struct isl_mat; diff --git a/polly/lib/External/isl/isl_map_subtract.c b/polly/lib/External/isl/isl_map_subtract.c index df16ea9..1ef50ae 100644 --- a/polly/lib/External/isl/isl_map_subtract.c +++ b/polly/lib/External/isl/isl_map_subtract.c @@ -187,7 +187,8 @@ static isl_stat tab_add_divs(struct isl_tab *tab, isl_seq_cpy(vec->el, bmap->div[i], 2 + dim); isl_seq_clr(vec->el + 2 + dim, tab->bmap->n_div); for (j = 0; j < i; ++j) - isl_int_set(vec->el[2 + dim + (*div_map)[j]], + isl_int_add(vec->el[2 + dim + (*div_map)[j]], + vec->el[2 + dim + (*div_map)[j]], bmap->div[i][2 + dim + j]); for (j = 0; j < tab->bmap->n_div; ++j) if (isl_seq_eq(tab->bmap->div[j], diff --git a/polly/lib/External/isl/isl_multi_templ.c b/polly/lib/External/isl/isl_multi_templ.c index 0769360..3403c50 100644 --- a/polly/lib/External/isl/isl_multi_templ.c +++ b/polly/lib/External/isl/isl_multi_templ.c @@ -27,8 +27,7 @@ isl_ctx *FN(MULTI(BASE),get_ctx)(__isl_keep MULTI(BASE) *multi) /* Return the space of "multi". */ -static __isl_keep isl_space *FN(MULTI(BASE),peek_space)( - __isl_keep MULTI(BASE) *multi) +__isl_keep isl_space *FN(MULTI(BASE),peek_space)(__isl_keep MULTI(BASE) *multi) { return multi ? multi->space : NULL; } diff --git a/polly/lib/External/isl/isl_multi_templ.h b/polly/lib/External/isl/isl_multi_templ.h index e82f057..c5049ad 100644 --- a/polly/lib/External/isl/isl_multi_templ.h +++ b/polly/lib/External/isl/isl_multi_templ.h @@ -26,6 +26,7 @@ struct MULTI(BASE) { }; __isl_give MULTI(BASE) *CAT(MULTI(BASE),_alloc)(__isl_take isl_space *space); +__isl_keep isl_space *FN(MULTI(BASE),peek_space)(__isl_keep MULTI(BASE) *multi); #ifdef EXPLICIT_DOMAIN isl_bool CAT(MULTI(BASE),_has_non_trivial_domain)( diff --git a/polly/lib/External/isl/isl_test.c b/polly/lib/External/isl/isl_test.c index 982efa0..3412e17 100644 --- a/polly/lib/External/isl/isl_test.c +++ b/polly/lib/External/isl/isl_test.c @@ -3602,6 +3602,44 @@ static int test_lift(isl_ctx *ctx) return 0; } +/* Check that isl_set_is_subset is not confused by identical + * integer divisions. + * The call to isl_set_normalize ensures that the equality constraints + * a = b = 0 are discovered, turning e0 and e1 into identical + * integer divisions. Any further simplification would remove + * the duplicate integer divisions. + */ +static isl_stat test_subset_duplicate_integer_divisions(isl_ctx *ctx) +{ + const char *str; + isl_bool is_subset; + isl_set *set1, *set2; + + str = "{ [a, b, c, d] : " + "exists (e0 = floor((a + d)/4), e1 = floor((d)/4), " + "e2 = floor((-a - d + 4 *floor((a + d)/4))/10), " + "e3 = floor((-d + 4*floor((d)/4))/10): " + "10e2 = -a - 2c - d + 4e0 and 10e3 = -2c - d + 4e1 and " + "b >= 0 and a <= 0 and b <= a) }"; + set1 = isl_set_read_from_str(ctx, str); + set2 = isl_set_read_from_str(ctx, str); + set2 = isl_set_normalize(set2); + + is_subset = isl_set_is_subset(set1, set2); + + isl_set_free(set1); + isl_set_free(set2); + + if (is_subset < 0) + return isl_stat_error; + if (!is_subset) + isl_die(ctx, isl_error_unknown, + "set is not considered to be a subset of itself", + return isl_stat_error); + + return isl_stat_ok; +} + struct { const char *set1; const char *set2; @@ -3646,6 +3684,9 @@ static int test_subset(isl_ctx *ctx) isl_set *set1, *set2; int subset; + if (test_subset_duplicate_integer_divisions(ctx) < 0) + return -1; + for (i = 0; i < ARRAY_SIZE(subset_tests); ++i) { set1 = isl_set_read_from_str(ctx, subset_tests[i].set1); set2 = isl_set_read_from_str(ctx, subset_tests[i].set2); @@ -3723,7 +3764,7 @@ static int test_subtract(isl_ctx *ctx) * does not increase the number of constraints. In particular, * the empty basic set should maintain its canonical representation. */ -static int test_intersect(isl_ctx *ctx) +static int test_intersect_1(isl_ctx *ctx) { int n1, n2; isl_basic_set *bset1, *bset2; @@ -3744,6 +3785,35 @@ static int test_intersect(isl_ctx *ctx) return 0; } +/* Check that intersecting a set with itself does not cause + * an explosion in the number of disjuncts. + */ +static isl_stat test_intersect_2(isl_ctx *ctx) +{ + int i; + isl_set *set; + + set = isl_set_read_from_str(ctx, "{ [x,y] : x >= 0 or y >= 0 }"); + for (i = 0; i < 100; ++i) + set = isl_set_intersect(set, isl_set_copy(set)); + isl_set_free(set); + if (!set) + return isl_stat_error; + return isl_stat_ok; +} + +/* Perform some intersection tests. + */ +static int test_intersect(isl_ctx *ctx) +{ + if (test_intersect_1(ctx) < 0) + return -1; + if (test_intersect_2(ctx) < 0) + return -1; + + return 0; +} + int test_factorize(isl_ctx *ctx) { const char *str; diff --git a/polly/lib/External/isl/isl_val.c b/polly/lib/External/isl/isl_val.c index da66463..7a37d18 100644 --- a/polly/lib/External/isl/isl_val.c +++ b/polly/lib/External/isl/isl_val.c @@ -295,15 +295,15 @@ long isl_val_get_num_si(__isl_keep isl_val *v) * * If "v" is not a rational value, then the result is undefined. */ -int isl_val_get_num_isl_int(__isl_keep isl_val *v, isl_int *n) +isl_stat isl_val_get_num_isl_int(__isl_keep isl_val *v, isl_int *n) { if (!v) - return -1; + return isl_stat_error; if (!isl_val_is_rat(v)) isl_die(isl_val_get_ctx(v), isl_error_invalid, - "expecting rational value", return -1); + "expecting rational value", return isl_stat_error); isl_int_set(*n, v->n); - return 0; + return isl_stat_ok; } /* Extract the denominator of a rational value "v" as an integer. @@ -1491,15 +1491,15 @@ int isl_val_plain_is_equal(__isl_keep isl_val *val1, __isl_keep isl_val *val2) * This function is only meant to be used in the generic isl_multi_* * functions which have to deal with base objects that have an associated * space. Since an isl_val does not have any coefficients, this function - * always return 0. + * always returns isl_bool_false. */ -int isl_val_involves_dims(__isl_keep isl_val *v, enum isl_dim_type type, +isl_bool isl_val_involves_dims(__isl_keep isl_val *v, enum isl_dim_type type, unsigned first, unsigned n) { if (!v) - return -1; + return isl_bool_error; - return 0; + return isl_bool_false; } /* Insert "n" dimensions of type "type" at position "first". diff --git a/polly/lib/External/isl/isl_val_private.h b/polly/lib/External/isl/isl_val_private.h index 4276ddb..1a4fa19 100644 --- a/polly/lib/External/isl/isl_val_private.h +++ b/polly/lib/External/isl/isl_val_private.h @@ -34,9 +34,9 @@ __isl_give isl_val *isl_val_rat_from_isl_int(isl_ctx *ctx, isl_int n, isl_int d); __isl_give isl_val *isl_val_cow(__isl_take isl_val *val); -int isl_val_get_num_isl_int(__isl_keep isl_val *v, isl_int *n); +isl_stat isl_val_get_num_isl_int(__isl_keep isl_val *v, isl_int *n); -int isl_val_involves_dims(__isl_keep isl_val *v, enum isl_dim_type type, +isl_bool isl_val_involves_dims(__isl_keep isl_val *v, enum isl_dim_type type, unsigned first, unsigned n); __isl_give isl_val *isl_val_insert_dims(__isl_take isl_val *v, enum isl_dim_type type, unsigned first, unsigned n); diff --git a/polly/lib/External/isl/test_inputs/codegen/cloog/classen.c b/polly/lib/External/isl/test_inputs/codegen/cloog/classen.c index 3155aa7..0201766 100644 --- a/polly/lib/External/isl/test_inputs/codegen/cloog/classen.c +++ b/polly/lib/External/isl/test_inputs/codegen/cloog/classen.c @@ -1,86 +1,63 @@ if (m >= 1) { - if (m == 1) { - S1(0, 1, 1, 1); - S8(0, 1); - } else { - S1(0, 1, 1, 1); + S1(0, 1, 1, 1); + if (m >= 2) { S2(0, 1, 1, 1, 1, 1, 2, 1); S3(0, 1, 1, 2, 1, 1, 1, 2); S4(0, 1, 2, 2, 1, 1, 2, 2); - S8(0, 1); } - for (int c0 = 1; c0 < 2 * m - 3; c0 += 1) { - if (c0 + 1 == m) { - S5(m - 2, 1, m - 1, 1, m - 1, 1, m, 1); - S1(m - 1, 1, m, 1); - S3(m - 1, 1, m, 2, m, 1, m, 2); - } else if (m >= c0 + 2) { - S5(c0 - 1, 1, c0, 1, c0, 1, c0 + 1, 1); - S1(c0, 1, c0 + 1, 1); - S2(c0, 1, c0 + 1, 1, c0 + 1, 1, c0 + 2, 1); - S4(c0, 1, c0 + 2, 2, c0 + 1, 1, c0 + 2, 2); - S3(c0, 1, c0 + 1, 2, c0 + 1, 1, c0 + 1, 2); - } else { - S5(c0 - 1, -m + c0 + 2, c0, -m + c0 + 2, m - 1, -m + c0 + 2, m, -m + c0 + 2); - S6(c0 - 1, -m + c0 + 1, c0, -m + c0 + 2, m, -m + c0 + 1, m, -m + c0 + 2); - S1(c0, -m + c0 + 2, m, -m + c0 + 2); - S3(c0, -m + c0 + 2, c0 + 1, -m + c0 + 3, m, -m + c0 + 2, m, -m + c0 + 3); - } - for (int c1 = max(2, -m + c0 + 3); c1 <= min(m - 1, c0); c1 += 1) { - S5(c0 - 1, c1, c0, c1, c0 - c1 + 1, c1, c0 - c1 + 2, c1); - S7(c0 - 1, c1 - 1, c0 + 1, c1, c0 - c1 + 2, c1 - 1, c0 - c1 + 3, c1); - S6(c0 - 1, c1 - 1, c0, c1, c0 - c1 + 2, c1 - 1, c0 - c1 + 2, c1); - S1(c0, c1, c0 - c1 + 2, c1); - S2(c0, c1, c0 + 1, c1, c0 - c1 + 2, c1, c0 - c1 + 3, c1); - S4(c0, c1, c0 + 2, c1 + 1, c0 - c1 + 2, c1, c0 - c1 + 3, c1 + 1); - S3(c0, c1, c0 + 1, c1 + 1, c0 - c1 + 2, c1, c0 - c1 + 2, c1 + 1); - } - if (c0 + 1 == m) { - S7(m - 2, m - 1, m, m, 1, m - 1, 2, m); - S6(m - 2, m - 1, m - 1, m, 1, m - 1, 1, m); - S1(m - 1, m, 1, m); - S2(m - 1, m, m, m, 1, m, 2, m); - } else if (c0 >= m) { - S5(c0 - 1, m, c0, m, -m + c0 + 1, m, -m + c0 + 2, m); - S7(c0 - 1, m - 1, c0 + 1, m, -m + c0 + 2, m - 1, -m + c0 + 3, m); - S6(c0 - 1, m - 1, c0, m, -m + c0 + 2, m - 1, -m + c0 + 2, m); - S1(c0, m, -m + c0 + 2, m); - S2(c0, m, c0 + 1, m, -m + c0 + 2, m, -m + c0 + 3, m); + S8(0, 1); + for (int c0 = 1; c0 < 2 * m - 1; c0 += 1) { + if (2 * m >= c0 + 3) { + if (c0 + 1 == m) { + S5(m - 2, 1, m - 1, 1, m - 1, 1, m, 1); + S1(m - 1, 1, m, 1); + S3(m - 1, 1, m, 2, m, 1, m, 2); + } else if (m >= c0 + 2) { + S5(c0 - 1, 1, c0, 1, c0, 1, c0 + 1, 1); + S1(c0, 1, c0 + 1, 1); + S2(c0, 1, c0 + 1, 1, c0 + 1, 1, c0 + 2, 1); + S4(c0, 1, c0 + 2, 2, c0 + 1, 1, c0 + 2, 2); + S3(c0, 1, c0 + 1, 2, c0 + 1, 1, c0 + 1, 2); + } else { + S5(c0 - 1, -m + c0 + 2, c0, -m + c0 + 2, m - 1, -m + c0 + 2, m, -m + c0 + 2); + S6(c0 - 1, -m + c0 + 1, c0, -m + c0 + 2, m, -m + c0 + 1, m, -m + c0 + 2); + S1(c0, -m + c0 + 2, m, -m + c0 + 2); + S3(c0, -m + c0 + 2, c0 + 1, -m + c0 + 3, m, -m + c0 + 2, m, -m + c0 + 3); + } + for (int c1 = max(2, -m + c0 + 3); c1 <= min(m - 1, c0); c1 += 1) { + S5(c0 - 1, c1, c0, c1, c0 - c1 + 1, c1, c0 - c1 + 2, c1); + S7(c0 - 1, c1 - 1, c0 + 1, c1, c0 - c1 + 2, c1 - 1, c0 - c1 + 3, c1); + S6(c0 - 1, c1 - 1, c0, c1, c0 - c1 + 2, c1 - 1, c0 - c1 + 2, c1); + S1(c0, c1, c0 - c1 + 2, c1); + S2(c0, c1, c0 + 1, c1, c0 - c1 + 2, c1, c0 - c1 + 3, c1); + S4(c0, c1, c0 + 2, c1 + 1, c0 - c1 + 2, c1, c0 - c1 + 3, c1 + 1); + S3(c0, c1, c0 + 1, c1 + 1, c0 - c1 + 2, c1, c0 - c1 + 2, c1 + 1); + } + if (c0 + 1 == m) { + S7(m - 2, m - 1, m, m, 1, m - 1, 2, m); + S6(m - 2, m - 1, m - 1, m, 1, m - 1, 1, m); + S1(m - 1, m, 1, m); + S2(m - 1, m, m, m, 1, m, 2, m); + } else if (m >= c0 + 2) { + S6(c0 - 1, c0, c0, c0 + 1, 1, c0, 1, c0 + 1); + S7(c0 - 1, c0, c0 + 1, c0 + 1, 1, c0, 2, c0 + 1); + S1(c0, c0 + 1, 1, c0 + 1); + S2(c0, c0 + 1, c0 + 1, c0 + 1, 1, c0 + 1, 2, c0 + 1); + S4(c0, c0 + 1, c0 + 2, c0 + 2, 1, c0 + 1, 2, c0 + 2); + S3(c0, c0 + 1, c0 + 1, c0 + 2, 1, c0 + 1, 1, c0 + 2); + } else { + S5(c0 - 1, m, c0, m, -m + c0 + 1, m, -m + c0 + 2, m); + S7(c0 - 1, m - 1, c0 + 1, m, -m + c0 + 2, m - 1, -m + c0 + 3, m); + S6(c0 - 1, m - 1, c0, m, -m + c0 + 2, m - 1, -m + c0 + 2, m); + S1(c0, m, -m + c0 + 2, m); + S2(c0, m, c0 + 1, m, -m + c0 + 2, m, -m + c0 + 3, m); + } } else { - S6(c0 - 1, c0, c0, c0 + 1, 1, c0, 1, c0 + 1); - S7(c0 - 1, c0, c0 + 1, c0 + 1, 1, c0, 2, c0 + 1); - S1(c0, c0 + 1, 1, c0 + 1); - S2(c0, c0 + 1, c0 + 1, c0 + 1, 1, c0 + 1, 2, c0 + 1); - S4(c0, c0 + 1, c0 + 2, c0 + 2, 1, c0 + 1, 2, c0 + 2); - S3(c0, c0 + 1, c0 + 1, c0 + 2, 1, c0 + 1, 1, c0 + 2); + S5(2 * m - 3, m, 2 * m - 2, m, m - 1, m, m, m); + S6(2 * m - 3, m - 1, 2 * m - 2, m, m, m - 1, m, m); + S1(2 * m - 2, m, m, m); } for (int c2 = max(1, -m + c0 + 2); c2 <= min(m, c0 + 1); c2 += 1) S8(c0, c2); } - if (m >= 2) { - if (m >= 3) { - S5(2 * m - 4, m - 1, 2 * m - 3, m - 1, m - 1, m - 1, m, m - 1); - S6(2 * m - 4, m - 2, 2 * m - 3, m - 1, m, m - 2, m, m - 1); - S1(2 * m - 3, m - 1, m, m - 1); - S3(2 * m - 3, m - 1, 2 * m - 2, m, m, m - 1, m, m); - S5(2 * m - 4, m, 2 * m - 3, m, m - 2, m, m - 1, m); - S7(2 * m - 4, m - 1, 2 * m - 2, m, m - 1, m - 1, m, m); - S6(2 * m - 4, m - 1, 2 * m - 3, m, m - 1, m - 1, m - 1, m); - S1(2 * m - 3, m, m - 1, m); - } else { - S5(0, 1, 1, 1, 1, 1, 2, 1); - S1(1, 1, 2, 1); - S3(1, 1, 2, 2, 2, 1, 2, 2); - S7(0, 1, 2, 2, 1, 1, 2, 2); - S6(0, 1, 1, 2, 1, 1, 1, 2); - S1(1, 2, 1, 2); - } - S2(2 * m - 3, m, 2 * m - 2, m, m - 1, m, m, m); - for (int c2 = m - 1; c2 <= m; c2 += 1) - S8(2 * m - 3, c2); - S5(2 * m - 3, m, 2 * m - 2, m, m - 1, m, m, m); - S6(2 * m - 3, m - 1, 2 * m - 2, m, m, m - 1, m, m); - S1(2 * m - 2, m, m, m); - S8(2 * m - 2, m); - } } diff --git a/polly/lib/External/isl/test_inputs/codegen/correlation.c b/polly/lib/External/isl/test_inputs/codegen/correlation.c index e771b43..8285005 100644 --- a/polly/lib/External/isl/test_inputs/codegen/correlation.c +++ b/polly/lib/External/isl/test_inputs/codegen/correlation.c @@ -1,5 +1,5 @@ for (int c0 = 0; c0 < m; c0 += 32) - for (int c1 = (n >= 32 && m >= c0 + 2) || (m == 1 && c0 == 0) ? 0 : 32 * n - 32 * floord(31 * n + 31, 32); c1 <= ((n <= -1 && c0 == 0) || (m == 1 && n >= 0 && c0 == 0) ? max(0, n - 1) : n); c1 += 32) + for (int c1 = (n >= 32 && m >= c0 + 2) || (m == 1 && c0 == 0) ? 0 : 32 * n - 32 * floord(31 * n + 31, 32); c1 <= ((n <= 0 && c0 == 0) || (m == 1 && n >= 1 && c0 == 0) ? max(0, n - 1) : n); c1 += 32) for (int c2 = c0; c2 <= (m >= 2 && c0 + 31 >= m && n >= c1 && c1 + 31 >= n ? 2 * m - 3 : (m >= 2 * c0 + 63 && c1 <= -32 && n >= c1 && c1 + 31 >= n) || (m >= c0 + 32 && 2 * c0 + 62 >= m && n >= c1 && c1 + 31 >= n) || (n >= 0 && c0 >= 32 && m >= 2 * c0 + 63 && c1 == n) || (m >= 63 && n >= 32 && c0 == 0 && c1 == n) ? 2 * c0 + 61 : m - 1); c2 += 32) { if (n >= c1 + 32 && c1 >= 0 && 2 * c0 >= c2 + 32) { for (int c4 = 0; c4 <= 31; c4 += 1) -- 2.7.4