diff --git a/polly/lib/External/CMakeLists.txt b/polly/lib/External/CMakeLists.txt index 8ab07d813cb4..7492127bd2b4 100644 --- a/polly/lib/External/CMakeLists.txt +++ b/polly/lib/External/CMakeLists.txt @@ -186,7 +186,6 @@ if (POLLY_BUNDLED_ISL) isl/isl_ast.c isl/isl_ast_codegen.c isl/isl_ast_graft.c - isl/isl_band.c isl/isl_bernstein.c isl/isl_blk.c isl/isl_bound.c @@ -242,6 +241,7 @@ if (POLLY_BUNDLED_ISL) isl/isl_set_list.c isl/isl_sort.c isl/isl_space.c + isl/isl_stride.c isl/isl_stream.c isl/isl_tab.c isl/isl_tab_pip.c diff --git a/polly/lib/External/isl/GIT_HEAD_ID b/polly/lib/External/isl/GIT_HEAD_ID index a2665ceef7d0..d29f76ec769a 100644 --- a/polly/lib/External/isl/GIT_HEAD_ID +++ b/polly/lib/External/isl/GIT_HEAD_ID @@ -1 +1 @@ -isl-0.18-812-g565da6e +isl-0.18-1047-g4a20ef8 diff --git a/polly/lib/External/isl/Makefile.am b/polly/lib/External/isl/Makefile.am index 4000277d3d45..4852c7e9182d 100644 --- a/polly/lib/External/isl/Makefile.am +++ b/polly/lib/External/isl/Makefile.am @@ -19,7 +19,6 @@ TESTS = isl_test codegen_test.sh pip_test.sh bound_test.sh isl_test_int \ if IMATH_FOR_MP MP_SRC = \ - isl_hide_deprecated.h \ isl_imath.c \ isl_imath.h \ isl_int_imath.h \ @@ -42,7 +41,6 @@ else MP_SRC += isl_val_imath.c endif -DEPRECATED_SRC = MP_INCLUDE_H = endif @@ -57,7 +55,6 @@ MP_SRC = \ isl_gmp.c \ isl_val_gmp.c -DEPRECATED_SRC = isl_ast_int.c MP_INCLUDE_H = include/isl/val_gmp.h endif @@ -66,7 +63,6 @@ AM_CFLAGS = @WARNING_FLAGS@ libisl_la_SOURCES = \ $(MP_SRC) \ - $(DEPRECATED_SRC) \ isl_aff.c \ isl_aff_private.h \ isl_affine_hull.c \ @@ -80,8 +76,6 @@ libisl_la_SOURCES = \ isl_ast_codegen.c \ isl_ast_graft.c \ isl_ast_graft_private.h \ - isl_band.c \ - isl_band_private.h \ isl_basis_reduction.h \ basis_reduction_tab.c \ isl_bernstein.c \ @@ -175,6 +169,7 @@ libisl_la_SOURCES = \ isl_stream_private.h \ isl_seq.c \ isl_seq.h \ + isl_stride.c \ isl_tab.c \ isl_tab.h \ isl_tab_pip.c \ @@ -277,7 +272,6 @@ pkginclude_HEADERS = \ include/isl/ast.h \ include/isl/ast_type.h \ include/isl/ast_build.h \ - include/isl/band.h \ include/isl/constraint.h \ include/isl/ctx.h \ include/isl/flow.h \ @@ -325,21 +319,6 @@ pkginclude_HEADERS = \ include/isl/vec.h \ include/isl/version.h \ include/isl/vertices.h -deprecateddir = $(pkgincludedir)/deprecated -deprecated_HEADERS = \ - include/isl/deprecated/int.h \ - include/isl/deprecated/aff_int.h \ - include/isl/deprecated/ast_int.h \ - include/isl/deprecated/constraint_int.h \ - include/isl/deprecated/ilp_int.h \ - include/isl/deprecated/map_int.h \ - include/isl/deprecated/mat_int.h \ - include/isl/deprecated/point_int.h \ - include/isl/deprecated/polynomial_int.h \ - include/isl/deprecated/set_int.h \ - include/isl/deprecated/union_map_int.h \ - include/isl/deprecated/val_int.h \ - include/isl/deprecated/vec_int.h BUILT_SOURCES = gitversion.h @@ -372,6 +351,7 @@ EXTRA_DIST = \ isl_multi_apply_union_set.c \ isl_multi_cmp.c \ isl_multi_coalesce.c \ + isl_multi_dims.c \ isl_multi_floor.c \ isl_multi_gist.c \ isl_multi_hash.c \ @@ -387,13 +367,14 @@ EXTRA_DIST = \ set_to_map.c \ set_from_map.c \ isl_tab_lexopt_templ.c \ + uset_to_umap.c \ isl_union_macro.h \ isl_union_templ.c \ isl_union_single.c \ isl_union_multi.c \ isl_union_eval.c \ isl_union_neg.c \ - isl.py \ + libisl-gdb.py \ doc/CodingStyle \ doc/SubmittingPatches \ doc/implementation.tex \ @@ -409,8 +390,8 @@ EXTRA_DIST = \ imath/imrat.c \ imath/imrat.h \ interface/all.h \ - interface/isl.h.top \ interface/isl.py.top \ + interface/isl_test_python.py \ test_inputs dist-hook: @@ -424,15 +405,17 @@ pkgconfig_DATA = $(pkgconfig_libfile) gitversion.h: @GIT_HEAD@ $(AM_V_GEN)echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@ -install-data-local: $(srcdir)/isl.py +install-data-local: $(srcdir)/libisl-gdb.py @libisl=`sed -ne "/^library_names=/{s/.*='//;s/'$$//;s/ .*//;p;}" \ $(builddir)/libisl.la`; \ case $$libisl in \ '') echo Cannot find isl library name. GDB bindings not installed.;; \ - *) echo $(INSTALL_DATA) $(srcdir)/isl.py \ + *) echo $(INSTALL_DATA) $(srcdir)/libisl-gdb.py \ $(DESTDIR)$(libdir)/$$libisl-gdb.py; \ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"; \ - $(INSTALL_DATA) $(srcdir)/isl.py $(DESTDIR)$(libdir)/$$libisl-gdb.py; esac + $(INSTALL_DATA) $(srcdir)/libisl-gdb.py \ + $(DESTDIR)$(libdir)/$$libisl-gdb.py; \ + esac uninstall-local: @libisl=`sed -ne "/^library_names=/{s/.*='//;s/'$$//;s/ .*//;p;}" \ diff --git a/polly/lib/External/isl/Makefile.in b/polly/lib/External/isl/Makefile.in index 3ea3a2fda0c0..209ab45f99de 100644 --- a/polly/lib/External/isl/Makefile.in +++ b/polly/lib/External/isl/Makefile.in @@ -117,8 +117,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_create_pkgconfig_info.m4 \ $(top_srcdir)/m4/ax_create_stdint_h.m4 \ - $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ $(top_srcdir)/m4/ax_detect_clang.m4 \ $(top_srcdir)/m4/ax_detect_git_head.m4 \ $(top_srcdir)/m4/ax_detect_gmp.m4 \ @@ -134,8 +132,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ - $(am__configure_deps) $(deprecated_HEADERS) \ - $(am__pkginclude_HEADERS_DIST) $(am__DIST_COMMON) + $(am__configure_deps) $(am__pkginclude_HEADERS_DIST) \ + $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d @@ -171,26 +169,25 @@ am__uninstall_files_from_dir = { \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" \ - "$(DESTDIR)$(deprecateddir)" "$(DESTDIR)$(pkgincludedir)" \ - "$(DESTDIR)$(pkgincludedir)" + "$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)" LTLIBRARIES = $(lib_LTLIBRARIES) libisl_la_DEPENDENCIES = am__libisl_la_SOURCES_DIST = mp_get_memory_functions.c isl_int_gmp.h \ - isl_gmp.c isl_val_gmp.c isl_hide_deprecated.h isl_imath.c \ - isl_imath.h isl_int_imath.h imath_wrap/gmp_compat.h \ - imath_wrap/imath.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_ast_int.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_ast_build_private.h isl_ast_build_expr.c \ + isl_gmp.c isl_val_gmp.c isl_imath.c isl_imath.h \ + isl_int_imath.h imath_wrap/gmp_compat.h imath_wrap/imath.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_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_band.c isl_band_private.h \ - isl_basis_reduction.h basis_reduction_tab.c isl_bernstein.c \ - isl_bernstein.h isl_blk.c isl_blk.h isl_bound.c isl_bound.h \ - isl_coalesce.c isl_constraint.c isl_constraint_private.h \ - isl_convex_hull.c isl_ctx.c isl_ctx_private.h isl_deprecated.c \ - isl_dim_map.h isl_dim_map.c isl_equalities.c isl_equalities.h \ + isl_ast_graft_private.h isl_basis_reduction.h \ + basis_reduction_tab.c isl_bernstein.c isl_bernstein.h \ + isl_blk.c isl_blk.h isl_bound.c isl_bound.h isl_coalesce.c \ + isl_constraint.c isl_constraint_private.h isl_convex_hull.c \ + isl_ctx.c isl_ctx_private.h isl_deprecated.c isl_dim_map.h \ + isl_dim_map.c isl_equalities.c isl_equalities.h \ isl_factorization.c isl_factorization.h isl_farkas.c isl_ffs.c \ isl_flow.c isl_fold.c isl_hash.c isl_hash_private.h \ isl_id_to_ast_expr.c isl_id_to_id.c isl_id_to_pw_aff.c \ @@ -211,8 +208,8 @@ am__libisl_la_SOURCES_DIST = mp_get_memory_functions.c isl_int_gmp.h \ isl_schedule_constraints.c isl_schedule_constraints.h \ isl_scheduler.c isl_set_list.c isl_sort.c isl_sort.h \ isl_space.c isl_space_private.h isl_stream.c \ - isl_stream_private.h isl_seq.c isl_seq.h isl_tab.c isl_tab.h \ - isl_tab_pip.c isl_tarjan.c isl_tarjan.h \ + isl_stream_private.h isl_seq.c isl_seq.h isl_stride.c \ + isl_tab.c isl_tab.h isl_tab_pip.c isl_tarjan.c isl_tarjan.h \ isl_transitive_closure.c isl_union_map.c \ isl_union_map_private.h isl_union_set_private.h isl_val.c \ isl_val_private.h isl_vec_private.h isl_vec.c isl_version.c \ @@ -232,26 +229,25 @@ 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 -@GMP_FOR_MP_TRUE@am__objects_5 = isl_ast_int.lo -am_libisl_la_OBJECTS = $(am__objects_4) $(am__objects_5) 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 \ - isl_band.lo basis_reduction_tab.lo isl_bernstein.lo isl_blk.lo \ - isl_bound.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_tab.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_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 @@ -420,29 +416,28 @@ DATA = $(pkgconfig_DATA) am__pkginclude_HEADERS_DIST = include/isl/val_gmp.h include/isl/aff.h \ include/isl/aff_type.h include/isl/arg.h include/isl/ast.h \ include/isl/ast_type.h include/isl/ast_build.h \ - include/isl/band.h include/isl/constraint.h include/isl/ctx.h \ - include/isl/flow.h include/isl/id.h \ - include/isl/id_to_ast_expr.h include/isl/id_to_id.h \ - include/isl/id_to_pw_aff.h include/isl/ilp.h \ - include/isl/hash.h include/isl/hmap.h include/isl/hmap_templ.c \ - include/isl/list.h include/isl/local_space.h include/isl/lp.h \ - include/isl/mat.h include/isl/map.h \ - include/isl/map_to_basic_set.h include/isl/map_type.h \ - include/isl/maybe.h include/isl/maybe_ast_expr.h \ - include/isl/maybe_basic_set.h include/isl/maybe_id.h \ - include/isl/maybe_pw_aff.h include/isl/maybe_templ.h \ - include/isl/multi.h include/isl/obj.h include/isl/options.h \ - include/isl/point.h include/isl/polynomial.h \ - include/isl/polynomial_type.h include/isl/printer.h \ - include/isl/printer_type.h include/isl/schedule.h \ - include/isl/schedule_node.h include/isl/schedule_type.h \ - include/isl/set.h include/isl/set_type.h include/isl/space.h \ + include/isl/constraint.h include/isl/ctx.h include/isl/flow.h \ + include/isl/id.h include/isl/id_to_ast_expr.h \ + include/isl/id_to_id.h include/isl/id_to_pw_aff.h \ + include/isl/ilp.h include/isl/hash.h include/isl/hmap.h \ + include/isl/hmap_templ.c include/isl/list.h \ + include/isl/local_space.h include/isl/lp.h include/isl/mat.h \ + include/isl/map.h include/isl/map_to_basic_set.h \ + include/isl/map_type.h include/isl/maybe.h \ + include/isl/maybe_ast_expr.h include/isl/maybe_basic_set.h \ + include/isl/maybe_id.h include/isl/maybe_pw_aff.h \ + include/isl/maybe_templ.h include/isl/multi.h \ + include/isl/obj.h include/isl/options.h include/isl/point.h \ + include/isl/polynomial.h include/isl/polynomial_type.h \ + include/isl/printer.h include/isl/printer_type.h \ + include/isl/schedule.h include/isl/schedule_node.h \ + include/isl/schedule_type.h include/isl/set.h \ + include/isl/set_type.h include/isl/space.h \ include/isl/stream.h include/isl/union_map.h \ include/isl/union_map_type.h include/isl/union_set.h \ include/isl/union_set_type.h include/isl/val.h \ include/isl/vec.h include/isl/version.h include/isl/vertices.h -HEADERS = $(deprecated_HEADERS) $(nodist_pkginclude_HEADERS) \ - $(pkginclude_HEADERS) +HEADERS = $(nodist_pkginclude_HEADERS) $(pkginclude_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ @@ -713,7 +708,6 @@ CLANG_LIBS = @CLANG_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ -CXX11FLAGS = @CXX11FLAGS@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -733,7 +727,6 @@ GIT_HEAD = @GIT_HEAD@ GIT_HEAD_ID = @GIT_HEAD_ID@ GIT_HEAD_VERSION = @GIT_HEAD_VERSION@ GREP = @GREP@ -HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -773,6 +766,11 @@ PDFLATEX = @PDFLATEX@ PERL = @PERL@ POD2HTML = @POD2HTML@ PRTDIAG = @PRTDIAG@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -825,9 +823,13 @@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfig_libdir = @pkgconfig_libdir@ pkgconfig_libfile = @pkgconfig_libfile@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ @@ -850,15 +852,12 @@ lib_LTLIBRARIES = libisl.la @GMP_FOR_MP_TRUE@ isl_gmp.c \ @GMP_FOR_MP_TRUE@ isl_val_gmp.c -@IMATH_FOR_MP_TRUE@MP_SRC = isl_hide_deprecated.h isl_imath.c \ -@IMATH_FOR_MP_TRUE@ isl_imath.h isl_int_imath.h \ +@IMATH_FOR_MP_TRUE@MP_SRC = isl_imath.c isl_imath.h isl_int_imath.h \ @IMATH_FOR_MP_TRUE@ imath_wrap/gmp_compat.h imath_wrap/imath.h \ @IMATH_FOR_MP_TRUE@ imath_wrap/imrat.h imath_wrap/wrap.h \ @IMATH_FOR_MP_TRUE@ imath_wrap/gmp_compat.c imath_wrap/imath.c \ @IMATH_FOR_MP_TRUE@ imath_wrap/imrat.c $(am__append_3) \ @IMATH_FOR_MP_TRUE@ $(am__append_4) -@GMP_FOR_MP_TRUE@DEPRECATED_SRC = isl_ast_int.c -@IMATH_FOR_MP_TRUE@DEPRECATED_SRC = @GMP_FOR_MP_TRUE@MP_INCLUDE_H = include/isl/val_gmp.h @IMATH_FOR_MP_TRUE@MP_INCLUDE_H = @GMP_FOR_MP_TRUE@@NEED_GET_MEMORY_FUNCTIONS_TRUE@GET_MEMORY_FUNCTIONS = mp_get_memory_functions.c @@ -866,7 +865,6 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I$(srcdir)/include -Iinclude/ @MP_CPPFLAGS@ AM_CFLAGS = @WARNING_FLAGS@ libisl_la_SOURCES = \ $(MP_SRC) \ - $(DEPRECATED_SRC) \ isl_aff.c \ isl_aff_private.h \ isl_affine_hull.c \ @@ -880,8 +878,6 @@ libisl_la_SOURCES = \ isl_ast_codegen.c \ isl_ast_graft.c \ isl_ast_graft_private.h \ - isl_band.c \ - isl_band_private.h \ isl_basis_reduction.h \ basis_reduction_tab.c \ isl_bernstein.c \ @@ -975,6 +971,7 @@ libisl_la_SOURCES = \ isl_stream_private.h \ isl_seq.c \ isl_seq.h \ + isl_stride.c \ isl_tab.c \ isl_tab.h \ isl_tab_pip.c \ @@ -1074,7 +1071,6 @@ pkginclude_HEADERS = \ include/isl/ast.h \ include/isl/ast_type.h \ include/isl/ast_build.h \ - include/isl/band.h \ include/isl/constraint.h \ include/isl/ctx.h \ include/isl/flow.h \ @@ -1123,22 +1119,6 @@ pkginclude_HEADERS = \ include/isl/version.h \ include/isl/vertices.h -deprecateddir = $(pkgincludedir)/deprecated -deprecated_HEADERS = \ - include/isl/deprecated/int.h \ - include/isl/deprecated/aff_int.h \ - include/isl/deprecated/ast_int.h \ - include/isl/deprecated/constraint_int.h \ - include/isl/deprecated/ilp_int.h \ - include/isl/deprecated/map_int.h \ - include/isl/deprecated/mat_int.h \ - include/isl/deprecated/point_int.h \ - include/isl/deprecated/polynomial_int.h \ - include/isl/deprecated/set_int.h \ - include/isl/deprecated/union_map_int.h \ - include/isl/deprecated/val_int.h \ - include/isl/deprecated/vec_int.h - BUILT_SOURCES = gitversion.h CLEANFILES = \ gitversion.h @@ -1169,6 +1149,7 @@ EXTRA_DIST = \ isl_multi_apply_union_set.c \ isl_multi_cmp.c \ isl_multi_coalesce.c \ + isl_multi_dims.c \ isl_multi_floor.c \ isl_multi_gist.c \ isl_multi_hash.c \ @@ -1184,13 +1165,14 @@ EXTRA_DIST = \ set_to_map.c \ set_from_map.c \ isl_tab_lexopt_templ.c \ + uset_to_umap.c \ isl_union_macro.h \ isl_union_templ.c \ isl_union_single.c \ isl_union_multi.c \ isl_union_eval.c \ isl_union_neg.c \ - isl.py \ + libisl-gdb.py \ doc/CodingStyle \ doc/SubmittingPatches \ doc/implementation.tex \ @@ -1206,8 +1188,8 @@ EXTRA_DIST = \ imath/imrat.c \ imath/imrat.h \ interface/all.h \ - interface/isl.h.top \ interface/isl.py.top \ + interface/isl_test_python.py \ test_inputs pkgconfigdir = $(pkgconfig_libdir) @@ -1424,8 +1406,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_ast_build_expr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_ast_codegen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_ast_graft.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_ast_int.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_band.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_bernstein.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_blk.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_bound.Plo@am__quote@ @@ -1483,6 +1463,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_sort.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_space.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_stream.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_stride.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_tab.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_tab_pip.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isl_tarjan.Plo@am__quote@ @@ -1565,27 +1546,6 @@ uninstall-pkgconfigDATA: @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) -install-deprecatedHEADERS: $(deprecated_HEADERS) - @$(NORMAL_INSTALL) - @list='$(deprecated_HEADERS)'; test -n "$(deprecateddir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(deprecateddir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(deprecateddir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(deprecateddir)'"; \ - $(INSTALL_HEADER) $$files "$(DESTDIR)$(deprecateddir)" || exit $$?; \ - done - -uninstall-deprecatedHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(deprecated_HEADERS)'; test -n "$(deprecateddir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(deprecateddir)'; $(am__uninstall_files_from_dir) install-nodist_pkgincludeHEADERS: $(nodist_pkginclude_HEADERS) @$(NORMAL_INSTALL) @list='$(nodist_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ @@ -2146,7 +2106,7 @@ all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS) \ isl_config.h installdirs: installdirs-recursive installdirs-am: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(deprecateddir)" "$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) @@ -2212,9 +2172,8 @@ info: info-recursive info-am: -install-data-am: install-data-local install-deprecatedHEADERS \ - install-nodist_pkgincludeHEADERS install-pkgconfigDATA \ - install-pkgincludeHEADERS +install-data-am: install-data-local install-nodist_pkgincludeHEADERS \ + install-pkgconfigDATA install-pkgincludeHEADERS install-dvi: install-dvi-recursive @@ -2262,9 +2221,9 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-deprecatedHEADERS uninstall-libLTLIBRARIES \ - uninstall-local uninstall-nodist_pkgincludeHEADERS \ - uninstall-pkgconfigDATA uninstall-pkgincludeHEADERS +uninstall-am: uninstall-libLTLIBRARIES uninstall-local \ + uninstall-nodist_pkgincludeHEADERS uninstall-pkgconfigDATA \ + uninstall-pkgincludeHEADERS .MAKE: $(am__recursive_targets) all check check-am install install-am \ install-strip @@ -2279,10 +2238,9 @@ uninstall-am: uninstall-deprecatedHEADERS uninstall-libLTLIBRARIES \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ - install-data-local install-deprecatedHEADERS install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am \ - install-libLTLIBRARIES install-man \ + install-data-local install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libLTLIBRARIES install-man \ install-nodist_pkgincludeHEADERS install-pdf install-pdf-am \ install-pkgconfigDATA install-pkgincludeHEADERS install-ps \ install-ps-am install-strip installcheck installcheck-am \ @@ -2290,9 +2248,9 @@ uninstall-am: uninstall-deprecatedHEADERS uninstall-libLTLIBRARIES \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am \ - uninstall-deprecatedHEADERS uninstall-libLTLIBRARIES \ - uninstall-local uninstall-nodist_pkgincludeHEADERS \ - uninstall-pkgconfigDATA uninstall-pkgincludeHEADERS + uninstall-libLTLIBRARIES uninstall-local \ + uninstall-nodist_pkgincludeHEADERS uninstall-pkgconfigDATA \ + uninstall-pkgincludeHEADERS .PRECIOUS: Makefile @@ -2305,15 +2263,17 @@ dist-hook: gitversion.h: @GIT_HEAD@ $(AM_V_GEN)echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@ -install-data-local: $(srcdir)/isl.py +install-data-local: $(srcdir)/libisl-gdb.py @libisl=`sed -ne "/^library_names=/{s/.*='//;s/'$$//;s/ .*//;p;}" \ $(builddir)/libisl.la`; \ case $$libisl in \ '') echo Cannot find isl library name. GDB bindings not installed.;; \ - *) echo $(INSTALL_DATA) $(srcdir)/isl.py \ + *) echo $(INSTALL_DATA) $(srcdir)/libisl-gdb.py \ $(DESTDIR)$(libdir)/$$libisl-gdb.py; \ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"; \ - $(INSTALL_DATA) $(srcdir)/isl.py $(DESTDIR)$(libdir)/$$libisl-gdb.py; esac + $(INSTALL_DATA) $(srcdir)/libisl-gdb.py \ + $(DESTDIR)$(libdir)/$$libisl-gdb.py; \ + esac uninstall-local: @libisl=`sed -ne "/^library_names=/{s/.*='//;s/'$$//;s/ .*//;p;}" \ diff --git a/polly/lib/External/isl/aclocal.m4 b/polly/lib/External/isl/aclocal.m4 index 638faddc90ba..b25d5531257a 100644 --- a/polly/lib/External/isl/aclocal.m4 +++ b/polly/lib/External/isl/aclocal.m4 @@ -812,6 +812,241 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) +# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + + +# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# --------------------------------------------------------------------------- +# Adds support for distributing Python modules and packages. To +# install modules, copy them to $(pythondir), using the python_PYTHON +# automake variable. To install a package with the same name as the +# automake package, install to $(pkgpythondir), or use the +# pkgpython_PYTHON automake variable. +# +# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as +# locations to install python extension modules (shared libraries). +# Another macro is required to find the appropriate flags to compile +# extension modules. +# +# If your package is configured with a different prefix to python, +# users will have to add the install directory to the PYTHONPATH +# environment variable, or create a .pth file (see the python +# documentation for details). +# +# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will +# cause an error if the version of python installed on the system +# doesn't meet the requirement. MINIMUM-VERSION should consist of +# numbers and dots only. +AC_DEFUN([AM_PATH_PYTHON], + [ + dnl Find a Python interpreter. Python versions prior to 2.0 are not + dnl supported. (2.0 was released on October 16, 2000). + m4_define_default([_AM_PYTHON_INTERPRETER_LIST], +[python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 dnl + python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0]) + + AC_ARG_VAR([PYTHON], [the Python interpreter]) + + m4_if([$1],[],[ + dnl No version check is needed. + # Find any Python interpreter. + if test -z "$PYTHON"; then + AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) + fi + am_display_PYTHON=python + ], [ + dnl A version check is needed. + if test -n "$PYTHON"; then + # If the user set $PYTHON, use it and don't search something else. + AC_MSG_CHECKING([whether $PYTHON version is >= $1]) + AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([Python interpreter is too old])]) + am_display_PYTHON=$PYTHON + else + # Otherwise, try each interpreter until we find one that satisfies + # VERSION. + AC_CACHE_CHECK([for a Python interpreter with version >= $1], + [am_cv_pathless_PYTHON],[ + for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do + test "$am_cv_pathless_PYTHON" = none && break + AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) + done]) + # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. + if test "$am_cv_pathless_PYTHON" = none; then + PYTHON=: + else + AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) + fi + am_display_PYTHON=$am_cv_pathless_PYTHON + fi + ]) + + if test "$PYTHON" = :; then + dnl Run any user-specified action, or abort. + m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) + else + + dnl Query Python for its version number. Getting [:3] seems to be + dnl the best way to do this; it's what "site.py" does in the standard + dnl library. + + AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], + [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`]) + AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) + + dnl Use the values of $prefix and $exec_prefix for the corresponding + dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made + dnl distinct variables so they can be overridden if need be. However, + dnl general consensus is that you shouldn't need this ability. + + AC_SUBST([PYTHON_PREFIX], ['${prefix}']) + AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}']) + + dnl At times (like when building shared libraries) you may want + dnl to know which OS platform Python thinks this is. + + AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], + [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) + AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) + + # Just factor out some code duplication. + am_python_setup_sysconfig="\ +import sys +# Prefer sysconfig over distutils.sysconfig, for better compatibility +# with python 3.x. See automake bug#10227. +try: + import sysconfig +except ImportError: + can_use_sysconfig = 0 +else: + can_use_sysconfig = 1 +# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: +# +try: + from platform import python_implementation + if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7': + can_use_sysconfig = 0 +except ImportError: + pass" + + dnl Set up 4 directories: + + dnl pythondir -- where to install python scripts. This is the + dnl site-packages directory, not the python standard library + dnl directory like in previous automake betas. This behavior + dnl is more consistent with lispdir.m4 for example. + dnl Query distutils for this directory. + AC_CACHE_CHECK([for $am_display_PYTHON script directory], + [am_cv_python_pythondir], + [if test "x$prefix" = xNONE + then + am_py_prefix=$ac_default_prefix + else + am_py_prefix=$prefix + fi + am_cv_python_pythondir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') +sys.stdout.write(sitedir)"` + case $am_cv_python_pythondir in + $am_py_prefix*) + am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` + am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` + ;; + *) + case $am_py_prefix in + /usr|/System*) ;; + *) + am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages + ;; + esac + ;; + esac + ]) + AC_SUBST([pythondir], [$am_cv_python_pythondir]) + + dnl pkgpythondir -- $PACKAGE directory under pythondir. Was + dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is + dnl more consistent with the rest of automake. + + AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) + + dnl pyexecdir -- directory for installing python extension modules + dnl (shared libraries) + dnl Query distutils for this directory. + AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], + [am_cv_python_pyexecdir], + [if test "x$exec_prefix" = xNONE + then + am_py_exec_prefix=$am_py_prefix + else + am_py_exec_prefix=$exec_prefix + fi + am_cv_python_pyexecdir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix') +sys.stdout.write(sitedir)"` + case $am_cv_python_pyexecdir in + $am_py_exec_prefix*) + am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` + am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` + ;; + *) + case $am_py_exec_prefix in + /usr|/System*) ;; + *) + am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages + ;; + esac + ;; + esac + ]) + AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) + + dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) + + AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) + + dnl Run any user-specified action. + $2 + fi + +]) + + +# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# --------------------------------------------------------------------------- +# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. +# Run ACTION-IF-FALSE otherwise. +# This test uses sys.hexversion instead of the string equivalent (first +# word of sys.version), in order to cope with versions such as 2.2c1. +# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). +AC_DEFUN([AM_PYTHON_CHECK_VERSION], + [prog="import sys +# split strings by '.' and convert to numeric. Append some zeros +# because we need at least 4 digits for the hex conversion. +# map returns an iterator in Python 3.0 and a list in 2.x +minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] +minverhex = 0 +# xrange is not present in Python 3.0 and range returns an iterator +for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] +sys.exit(sys.hexversion < minverhex)" + AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) + # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation @@ -1156,8 +1391,6 @@ m4_include([m4/ax_check_compiler_flags.m4]) m4_include([m4/ax_compiler_vendor.m4]) m4_include([m4/ax_create_pkgconfig_info.m4]) m4_include([m4/ax_create_stdint_h.m4]) -m4_include([m4/ax_cxx_compile_stdcxx.m4]) -m4_include([m4/ax_cxx_compile_stdcxx_11.m4]) m4_include([m4/ax_detect_clang.m4]) m4_include([m4/ax_detect_git_head.m4]) m4_include([m4/ax_detect_gmp.m4]) diff --git a/polly/lib/External/isl/bound.c b/polly/lib/External/isl/bound.c index 00b643d8fa09..cfb2b6148947 100644 --- a/polly/lib/External/isl/bound.c +++ b/polly/lib/External/isl/bound.c @@ -1,11 +1,10 @@ #include #include #include -#include +#include #include +#include #include -#include -#include struct bound_options { struct isl_options *isl; @@ -63,7 +62,7 @@ static isl_stat verify_point(__isl_take isl_point *pnt, void *user) int i; unsigned nparam; struct verify_point_bound *vpb = (struct verify_point_bound *) user; - isl_int t; + isl_val *v; isl_ctx *ctx; isl_pw_qpolynomial_fold *pwf; isl_val *bound = NULL; @@ -89,14 +88,12 @@ static isl_stat verify_point(__isl_take isl_point *pnt, void *user) ctx = isl_point_get_ctx(pnt); p = isl_printer_to_file(ctx, out); - isl_int_init(t); - pwf = isl_pw_qpolynomial_fold_copy(vpb->pwf); nparam = isl_pw_qpolynomial_fold_dim(pwf, isl_dim_param); for (i = 0; i < nparam; ++i) { - isl_point_get_coordinate(pnt, isl_dim_param, i, &t); - pwf = isl_pw_qpolynomial_fold_fix_dim(pwf, isl_dim_param, i, t); + v = isl_point_get_coordinate_val(pnt, isl_dim_param, i); + pwf = isl_pw_qpolynomial_fold_fix_val(pwf, isl_dim_param, i, v); } bound = isl_pw_qpolynomial_fold_eval( @@ -133,8 +130,9 @@ static isl_stat verify_point(__isl_take isl_point *pnt, void *user) for (i = 0; i < nparam; ++i) { if (i) p = isl_printer_print_str(p, ", "); - isl_point_get_coordinate(pnt, isl_dim_param, i, &t); - p = isl_printer_print_isl_int(p, t); + v = isl_point_get_coordinate_val(pnt, isl_dim_param, i); + p = isl_printer_print_val(p, v); + isl_val_free(v); } p = isl_printer_print_str(p, ") = "); p = isl_printer_print_val(p, bound); @@ -163,8 +161,6 @@ error: isl_point_free(pnt); isl_set_free(dom); - isl_int_clear(t); - isl_printer_free(p); if (!ok) diff --git a/polly/lib/External/isl/codegen.c b/polly/lib/External/isl/codegen.c index 835b51d5b7b7..af2e18c03780 100644 --- a/polly/lib/External/isl/codegen.c +++ b/polly/lib/External/isl/codegen.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/polly/lib/External/isl/configure b/polly/lib/External/isl/configure index d208abcf80d4..a8029307f333 100755 --- a/polly/lib/External/isl/configure +++ b/polly/lib/External/isl/configure @@ -650,8 +650,6 @@ CLANG_LDFLAGS CLANG_CXXFLAGS SMALL_INT_OPT_FALSE SMALL_INT_OPT_TRUE -HAVE_CXX11_FALSE -HAVE_CXX11_TRUE GMP_FOR_MP_FALSE GMP_FOR_MP_TRUE IMATH_FOR_MP_FALSE @@ -666,6 +664,17 @@ GENERATE_DOC_TRUE POD2HTML PDFLATEX PERL +HAVE_PYTHON_FALSE +HAVE_PYTHON_TRUE +pkgpyexecdir +pyexecdir +pkgpythondir +pythondir +PYTHON_PLATFORM +PYTHON_EXEC_PREFIX +PYTHON_PREFIX +PYTHON_VERSION +PYTHON CXXCPP CPP LT_SYS_LIBRARY_PATH @@ -690,8 +699,6 @@ EGREP SED LIBTOOL GREP -HAVE_CXX11 -CXX11FLAGS PRTDIAG host_os host_vendor @@ -828,7 +835,8 @@ CXXFLAGS CCC LT_SYS_LIBRARY_PATH CPP -CXXCPP' +CXXCPP +PYTHON' # Initialize some variables set by options. @@ -1513,6 +1521,7 @@ Some influential environment variables: User-defined run-time library search path. CPP C preprocessor CXXCPP C++ preprocessor + PYTHON the Python interpreter Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -5925,682 +5934,6 @@ $as_echo "#define HAVE___ATTRIBUTE__ 1" >>confdefs.h fi -# CXX11FLAGS contains the flags (if any) added by AX_CXX_COMPILE_STDCXX_11 -# Original state of CXX and CXXCPP is preserved because CXX11FLAGS -# is only needed for compiling interface/isl_test_cpp - -ac_save_CXX="$CXX" -ac_save_CXXCPP="$CXXCPP" - - ax_cxx_compile_alternatives="11 0x" ax_cxx_compile_cxx11_required=false - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - ac_success=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5 -$as_echo_n "checking whether $CXX supports C++11 features by default... " >&6; } -if ${ax_cv_cxx_compile_cxx11+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -// If the compiler admits that it is not ready for C++11, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201103L - -#error "This is not a C++11 compiler" - -#else - -namespace cxx11 -{ - - namespace test_static_assert - { - - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - } - - namespace test_final_override - { - - struct Base - { - virtual void f() {} - }; - - struct Derived : public Base - { - virtual void f() override {} - }; - - } - - namespace test_double_right_angle_brackets - { - - template < typename T > - struct check {}; - - typedef check single_type; - typedef check> double_type; - typedef check>> triple_type; - typedef check>>> quadruple_type; - - } - - namespace test_decltype - { - - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } - - } - - namespace test_type_deduction - { - - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - - template < typename T > - struct is_same - { - static const bool value = true; - }; - - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } - - int - test(const int c, volatile int v) - { - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } - - } - - namespace test_noexcept - { - - int f() { return 0; } - int g() noexcept { return 0; } - - static_assert(noexcept(f()) == false, ""); - static_assert(noexcept(g()) == true, ""); - - } - - namespace test_constexpr - { - - template < typename CharT > - unsigned long constexpr - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept - { - return *s ? strlen_c_r(s + 1, acc + 1) : acc; - } - - template < typename CharT > - unsigned long constexpr - strlen_c(const CharT *const s) noexcept - { - return strlen_c_r(s, 0UL); - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("1") == 1UL, ""); - static_assert(strlen_c("example") == 7UL, ""); - static_assert(strlen_c("another\0example") == 7UL, ""); - - } - - namespace test_rvalue_references - { - - template < int N > - struct answer - { - static constexpr int value = N; - }; - - answer<1> f(int&) { return answer<1>(); } - answer<2> f(const int&) { return answer<2>(); } - answer<3> f(int&&) { return answer<3>(); } - - void - test() - { - int i = 0; - const int c = 0; - static_assert(decltype(f(i))::value == 1, ""); - static_assert(decltype(f(c))::value == 2, ""); - static_assert(decltype(f(0))::value == 3, ""); - } - - } - - namespace test_uniform_initialization - { - - struct test - { - static const int zero {}; - static const int one {1}; - }; - - static_assert(test::zero == 0, ""); - static_assert(test::one == 1, ""); - - } - - namespace test_lambdas - { - - void - test1() - { - auto lambda1 = [](){}; - auto lambda2 = lambda1; - lambda1(); - lambda2(); - } - - int - test2() - { - auto a = [](int i, int j){ return i + j; }(1, 2); - auto b = []() -> int { return '0'; }(); - auto c = [=](){ return a + b; }(); - auto d = [&](){ return c; }(); - auto e = [a, &b](int x) mutable { - const auto identity = [](int y){ return y; }; - for (auto i = 0; i < a; ++i) - a += b--; - return x + identity(a + b); - }(0); - return a + b + c + d + e; - } - - int - test3() - { - const auto nullary = [](){ return 0; }; - const auto unary = [](int x){ return x; }; - using nullary_t = decltype(nullary); - using unary_t = decltype(unary); - const auto higher1st = [](nullary_t f){ return f(); }; - const auto higher2nd = [unary](nullary_t f1){ - return [unary, f1](unary_t f2){ return f2(unary(f1())); }; - }; - return higher1st(nullary) + higher2nd(nullary)(unary); - } - - } - - namespace test_variadic_templates - { - - template - struct sum; - - template - struct sum - { - static constexpr auto value = N0 + sum::value; - }; - - template <> - struct sum<> - { - static constexpr auto value = 0; - }; - - static_assert(sum<>::value == 0, ""); - static_assert(sum<1>::value == 1, ""); - static_assert(sum<23>::value == 23, ""); - static_assert(sum<1, 2>::value == 3, ""); - static_assert(sum<5, 5, 11>::value == 21, ""); - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - - } - - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function - // because of this. - namespace test_template_alias_sfinae - { - - struct foo {}; - - template - using member = typename T::member_type; - - template - void func(...) {} - - template - void func(member*) {} - - void test(); - - void test() { func(0); } - - } - -} // namespace cxx11 - -#endif // __cplusplus >= 201103L - - - -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv_cxx_compile_cxx11=yes -else - ax_cv_cxx_compile_cxx11=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx11" >&5 -$as_echo "$ax_cv_cxx_compile_cxx11" >&6; } - if test x$ax_cv_cxx_compile_cxx11 = xyes; then - ac_success=yes - fi - - - - if test x$ac_success = xno; then - for alternative in ${ax_cxx_compile_alternatives}; do - for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do - cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5 -$as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; } -if eval \${$cachevar+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_CXX="$CXX" - CXX="$CXX $switch" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -// If the compiler admits that it is not ready for C++11, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201103L - -#error "This is not a C++11 compiler" - -#else - -namespace cxx11 -{ - - namespace test_static_assert - { - - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - } - - namespace test_final_override - { - - struct Base - { - virtual void f() {} - }; - - struct Derived : public Base - { - virtual void f() override {} - }; - - } - - namespace test_double_right_angle_brackets - { - - template < typename T > - struct check {}; - - typedef check single_type; - typedef check> double_type; - typedef check>> triple_type; - typedef check>>> quadruple_type; - - } - - namespace test_decltype - { - - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } - - } - - namespace test_type_deduction - { - - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - - template < typename T > - struct is_same - { - static const bool value = true; - }; - - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } - - int - test(const int c, volatile int v) - { - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } - - } - - namespace test_noexcept - { - - int f() { return 0; } - int g() noexcept { return 0; } - - static_assert(noexcept(f()) == false, ""); - static_assert(noexcept(g()) == true, ""); - - } - - namespace test_constexpr - { - - template < typename CharT > - unsigned long constexpr - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept - { - return *s ? strlen_c_r(s + 1, acc + 1) : acc; - } - - template < typename CharT > - unsigned long constexpr - strlen_c(const CharT *const s) noexcept - { - return strlen_c_r(s, 0UL); - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("1") == 1UL, ""); - static_assert(strlen_c("example") == 7UL, ""); - static_assert(strlen_c("another\0example") == 7UL, ""); - - } - - namespace test_rvalue_references - { - - template < int N > - struct answer - { - static constexpr int value = N; - }; - - answer<1> f(int&) { return answer<1>(); } - answer<2> f(const int&) { return answer<2>(); } - answer<3> f(int&&) { return answer<3>(); } - - void - test() - { - int i = 0; - const int c = 0; - static_assert(decltype(f(i))::value == 1, ""); - static_assert(decltype(f(c))::value == 2, ""); - static_assert(decltype(f(0))::value == 3, ""); - } - - } - - namespace test_uniform_initialization - { - - struct test - { - static const int zero {}; - static const int one {1}; - }; - - static_assert(test::zero == 0, ""); - static_assert(test::one == 1, ""); - - } - - namespace test_lambdas - { - - void - test1() - { - auto lambda1 = [](){}; - auto lambda2 = lambda1; - lambda1(); - lambda2(); - } - - int - test2() - { - auto a = [](int i, int j){ return i + j; }(1, 2); - auto b = []() -> int { return '0'; }(); - auto c = [=](){ return a + b; }(); - auto d = [&](){ return c; }(); - auto e = [a, &b](int x) mutable { - const auto identity = [](int y){ return y; }; - for (auto i = 0; i < a; ++i) - a += b--; - return x + identity(a + b); - }(0); - return a + b + c + d + e; - } - - int - test3() - { - const auto nullary = [](){ return 0; }; - const auto unary = [](int x){ return x; }; - using nullary_t = decltype(nullary); - using unary_t = decltype(unary); - const auto higher1st = [](nullary_t f){ return f(); }; - const auto higher2nd = [unary](nullary_t f1){ - return [unary, f1](unary_t f2){ return f2(unary(f1())); }; - }; - return higher1st(nullary) + higher2nd(nullary)(unary); - } - - } - - namespace test_variadic_templates - { - - template - struct sum; - - template - struct sum - { - static constexpr auto value = N0 + sum::value; - }; - - template <> - struct sum<> - { - static constexpr auto value = 0; - }; - - static_assert(sum<>::value == 0, ""); - static_assert(sum<1>::value == 1, ""); - static_assert(sum<23>::value == 23, ""); - static_assert(sum<1, 2>::value == 3, ""); - static_assert(sum<5, 5, 11>::value == 21, ""); - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - - } - - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function - // because of this. - namespace test_template_alias_sfinae - { - - struct foo {}; - - template - using member = typename T::member_type; - - template - void func(...) {} - - template - void func(member*) {} - - void test(); - - void test() { func(0); } - - } - -} // namespace cxx11 - -#endif // __cplusplus >= 201103L - - - -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - eval $cachevar=yes -else - eval $cachevar=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CXX="$ac_save_CXX" -fi -eval ac_res=\$$cachevar - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - if test x$ac_success = xyes; then - break - fi - done - fi - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - if test x$ax_cxx_compile_cxx11_required = xtrue; then - if test x$ac_success = xno; then - as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5 - fi - fi - if test x$ac_success = xno; then - HAVE_CXX11=0 - { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5 -$as_echo "$as_me: No compiler with C++11 support was found" >&6;} - else - HAVE_CXX11=1 - -$as_echo "#define HAVE_CXX11 1" >>confdefs.h - - fi - - - -CXX11FLAGS=${CXX#$ac_save_CXX} -CXX="$ac_save_CXX" -CXXCPP="$ac_save_CXXCPP" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : @@ -10300,6 +9633,7 @@ done + func_stripname_cnf () { case $2 in @@ -18013,6 +17347,275 @@ $as_echo "$ac_cv_path_SED" >&6; } rm -f conftest.sed + + + + + + if test -n "$PYTHON"; then + # If the user set $PYTHON, use it and don't search something else. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version is >= 2.5" >&5 +$as_echo_n "checking whether $PYTHON version is >= 2.5... " >&6; } + prog="import sys +# split strings by '.' and convert to numeric. Append some zeros +# because we need at least 4 digits for the hex conversion. +# map returns an iterator in Python 3.0 and a list in 2.x +minver = list(map(int, '2.5'.split('.'))) + [0, 0, 0] +minverhex = 0 +# xrange is not present in Python 3.0 and range returns an iterator +for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] +sys.exit(sys.hexversion < minverhex)" + if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5 + ($PYTHON -c "$prog") >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "Python interpreter is too old" "$LINENO" 5 +fi + am_display_PYTHON=$PYTHON + else + # Otherwise, try each interpreter until we find one that satisfies + # VERSION. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 2.5" >&5 +$as_echo_n "checking for a Python interpreter with version >= 2.5... " >&6; } +if ${am_cv_pathless_PYTHON+:} false; then : + $as_echo_n "(cached) " >&6 +else + + for am_cv_pathless_PYTHON in python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do + test "$am_cv_pathless_PYTHON" = none && break + prog="import sys +# split strings by '.' and convert to numeric. Append some zeros +# because we need at least 4 digits for the hex conversion. +# map returns an iterator in Python 3.0 and a list in 2.x +minver = list(map(int, '2.5'.split('.'))) + [0, 0, 0] +minverhex = 0 +# xrange is not present in Python 3.0 and range returns an iterator +for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] +sys.exit(sys.hexversion < minverhex)" + if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5 + ($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then : + break +fi + done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_pathless_PYTHON" >&5 +$as_echo "$am_cv_pathless_PYTHON" >&6; } + # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. + if test "$am_cv_pathless_PYTHON" = none; then + PYTHON=: + else + # Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args. +set dummy $am_cv_pathless_PYTHON; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PYTHON+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PYTHON in + [\\/]* | ?:[\\/]*) + ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PYTHON=$ac_cv_path_PYTHON +if test -n "$PYTHON"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 +$as_echo "$PYTHON" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + am_display_PYTHON=$am_cv_pathless_PYTHON + fi + + + if test "$PYTHON" = :; then + : + else + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5 +$as_echo_n "checking for $am_display_PYTHON version... " >&6; } +if ${am_cv_python_version+:} false; then : + $as_echo_n "(cached) " >&6 +else + am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5 +$as_echo "$am_cv_python_version" >&6; } + PYTHON_VERSION=$am_cv_python_version + + + + PYTHON_PREFIX='${prefix}' + + PYTHON_EXEC_PREFIX='${exec_prefix}' + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5 +$as_echo_n "checking for $am_display_PYTHON platform... " >&6; } +if ${am_cv_python_platform+:} false; then : + $as_echo_n "(cached) " >&6 +else + am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5 +$as_echo "$am_cv_python_platform" >&6; } + PYTHON_PLATFORM=$am_cv_python_platform + + + # Just factor out some code duplication. + am_python_setup_sysconfig="\ +import sys +# Prefer sysconfig over distutils.sysconfig, for better compatibility +# with python 3.x. See automake bug#10227. +try: + import sysconfig +except ImportError: + can_use_sysconfig = 0 +else: + can_use_sysconfig = 1 +# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: +# +try: + from platform import python_implementation + if python_implementation() == 'CPython' and sys.version[:3] == '2.7': + can_use_sysconfig = 0 +except ImportError: + pass" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5 +$as_echo_n "checking for $am_display_PYTHON script directory... " >&6; } +if ${am_cv_python_pythondir+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$prefix" = xNONE + then + am_py_prefix=$ac_default_prefix + else + am_py_prefix=$prefix + fi + am_cv_python_pythondir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') +sys.stdout.write(sitedir)"` + case $am_cv_python_pythondir in + $am_py_prefix*) + am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` + am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` + ;; + *) + case $am_py_prefix in + /usr|/System*) ;; + *) + am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages + ;; + esac + ;; + esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5 +$as_echo "$am_cv_python_pythondir" >&6; } + pythondir=$am_cv_python_pythondir + + + + pkgpythondir=\${pythondir}/$PACKAGE + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5 +$as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; } +if ${am_cv_python_pyexecdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$exec_prefix" = xNONE + then + am_py_exec_prefix=$am_py_prefix + else + am_py_exec_prefix=$exec_prefix + fi + am_cv_python_pyexecdir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix') +sys.stdout.write(sitedir)"` + case $am_cv_python_pyexecdir in + $am_py_exec_prefix*) + am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` + am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` + ;; + *) + case $am_py_exec_prefix in + /usr|/System*) ;; + *) + am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages + ;; + esac + ;; + esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5 +$as_echo "$am_cv_python_pyexecdir" >&6; } + pyexecdir=$am_cv_python_pyexecdir + + + + pkgpyexecdir=\${pyexecdir}/$PACKAGE + + + + fi + + + if test "$PYTHON" != :; then + HAVE_PYTHON_TRUE= + HAVE_PYTHON_FALSE='#' +else + HAVE_PYTHON_TRUE='#' + HAVE_PYTHON_FALSE= +fi + + # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -18904,14 +18507,6 @@ else fi - if test "x$HAVE_CXX11" = "x1"; then - HAVE_CXX11_TRUE= - HAVE_CXX11_FALSE='#' -else - HAVE_CXX11_TRUE='#' - HAVE_CXX11_FALSE= -fi - if test "x$with_int" == "ximath-32"; then SMALL_INT_OPT_TRUE= SMALL_INT_OPT_FALSE='#' @@ -20232,6 +19827,10 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_PYTHON_TRUE}" && test -z "${HAVE_PYTHON_FALSE}"; then + as_fn_error $? "conditional \"HAVE_PYTHON\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${GENERATE_DOC_TRUE}" && test -z "${GENERATE_DOC_FALSE}"; then as_fn_error $? "conditional \"GENERATE_DOC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -20252,10 +19851,6 @@ if test -z "${GMP_FOR_MP_TRUE}" && test -z "${GMP_FOR_MP_FALSE}"; then as_fn_error $? "conditional \"GMP_FOR_MP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_CXX11_TRUE}" && test -z "${HAVE_CXX11_FALSE}"; then - as_fn_error $? "conditional \"HAVE_CXX11\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${SMALL_INT_OPT_TRUE}" && test -z "${SMALL_INT_OPT_FALSE}"; then as_fn_error $? "conditional \"SMALL_INT_OPT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/polly/lib/External/isl/configure.ac b/polly/lib/External/isl/configure.ac index 5de7b5aa4b89..a5b83eaca9de 100644 --- a/polly/lib/External/isl/configure.ac +++ b/polly/lib/External/isl/configure.ac @@ -25,20 +25,11 @@ AX_CC_MAXOPT AX_GCC_WARN_UNUSED_RESULT AX_C___ATTRIBUTE__ -# CXX11FLAGS contains the flags (if any) added by AX_CXX_COMPILE_STDCXX_11 -# Original state of CXX and CXXCPP is preserved because CXX11FLAGS -# is only needed for compiling interface/isl_test_cpp -AC_SUBST(CXX11FLAGS) -ac_save_CXX="$CXX" -ac_save_CXXCPP="$CXXCPP" -AX_CXX_COMPILE_STDCXX_11([noext], [optional]) -CXX11FLAGS=${CXX#$ac_save_CXX} -CXX="$ac_save_CXX" -CXXCPP="$ac_save_CXXCPP" - AC_PROG_GREP AC_PROG_LIBTOOL AC_PROG_SED +AM_PATH_PYTHON([2.5], [], [:]) +AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :]) AC_CHECK_PROG(PERL, perl, perl, []) AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex, []) @@ -79,7 +70,6 @@ fi AM_CONDITIONAL(IMATH_FOR_MP, test x$with_int = ximath -o x$with_int = ximath-32) AM_CONDITIONAL(GMP_FOR_MP, test x$with_int = xgmp) -AM_CONDITIONAL(HAVE_CXX11, test "x$HAVE_CXX11" = "x1") AM_CONDITIONAL(SMALL_INT_OPT, test "x$with_int" == "ximath-32") AS_IF([test "x$with_int" == "ximath-32"], [ AC_DEFINE([USE_SMALL_INT_OPT], [], [Use small integer optimization]) diff --git a/polly/lib/External/isl/doc/Makefile.in b/polly/lib/External/isl/doc/Makefile.in index b5d190581334..ba695d1045c8 100644 --- a/polly/lib/External/isl/doc/Makefile.in +++ b/polly/lib/External/isl/doc/Makefile.in @@ -95,8 +95,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_create_pkgconfig_info.m4 \ $(top_srcdir)/m4/ax_create_stdint_h.m4 \ - $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ $(top_srcdir)/m4/ax_detect_clang.m4 \ $(top_srcdir)/m4/ax_detect_git_head.m4 \ $(top_srcdir)/m4/ax_detect_gmp.m4 \ @@ -155,7 +153,6 @@ CLANG_LIBS = @CLANG_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ -CXX11FLAGS = @CXX11FLAGS@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -175,7 +172,6 @@ GIT_HEAD = @GIT_HEAD@ GIT_HEAD_ID = @GIT_HEAD_ID@ GIT_HEAD_VERSION = @GIT_HEAD_VERSION@ GREP = @GREP@ -HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -215,6 +211,11 @@ PDFLATEX = @PDFLATEX@ PERL = @PERL@ POD2HTML = @POD2HTML@ PRTDIAG = @PRTDIAG@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -267,9 +268,13 @@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfig_libdir = @pkgconfig_libdir@ pkgconfig_libfile = @pkgconfig_libfile@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ diff --git a/polly/lib/External/isl/doc/user.pod b/polly/lib/External/isl/doc/user.pod index 1bb0da4855d5..7c0a112ca695 100644 --- a/polly/lib/External/isl/doc/user.pod +++ b/polly/lib/External/isl/doc/user.pod @@ -586,9 +586,6 @@ in which the object was created. isl_ctx *isl_schedule_node_get_ctx( __isl_keep isl_schedule_node *node); - #include - isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band); - #include isl_ctx *isl_ast_build_get_ctx( __isl_keep isl_ast_build *build); @@ -843,18 +840,27 @@ the last error in the corresponding C and the function in which the error was triggered returns a value indicating that some error has occurred. In case of functions returning a pointer, this value is C. In case of functions returning an C or an -C, this valus is C or C. +C, this value is C or C. An error does not corrupt internal state, such that isl can continue to be used. C also provides functions to -read the last error and to reset the memory that stores the last error. The +read the last error, including the specific error message, +the isl source file where the error occurred and the line number, +and to reset all information about the last error. The last error is only stored for information purposes. Its presence does not change the behavior of C. Hence, resetting an error is not required to continue to use isl, but only to observe new errors. #include enum isl_error isl_ctx_last_error(isl_ctx *ctx); + const char *isl_ctx_last_error_msg(isl_ctx *ctx); + const char *isl_ctx_last_error_file(isl_ctx *ctx); + int isl_ctx_last_error_line(isl_ctx *ctx); void isl_ctx_reset_error(isl_ctx *ctx); +If no error has occurred since the last call to C, +then the functions C and +C return C. + Another option is to continue on error. This is similar to warn on error mode, except that C does not print any warning. This allows a program to implement its own error reporting. @@ -1171,6 +1177,16 @@ an C and an C only have parameters. +Additional parameters can be added to a space using the following function. + + #include + __isl_give isl_space *isl_space_add_param_id( + __isl_take isl_space *space, + __isl_take isl_id *id); + +If a parameter with the given identifier already appears in the space, +then it is not added again. + The identifiers or names of the individual dimensions of spaces may be set or read off using the following functions on spaces or objects that live in spaces. @@ -2174,19 +2190,30 @@ no explicit representation is known. To iterate over all the sets or maps in a union set or map, use + #include isl_stat isl_union_set_foreach_set( __isl_keep isl_union_set *uset, isl_stat (*fn)(__isl_take isl_set *set, void *user), void *user); + + #include isl_stat isl_union_map_foreach_map( __isl_keep isl_union_map *umap, isl_stat (*fn)(__isl_take isl_map *map, void *user), void *user); + isl_bool isl_union_map_every_map( + __isl_keep isl_union_map *umap, + isl_bool (*test)(__isl_keep isl_map *map, + void *user), + void *user); These functions call the callback function once for each (pair of) space(s) for which there are elements in the input. The argument to the callback contains all elements in the input with that (pair of) space(s). +The C variant check whether each +call to the callback returns true and stops checking as soon as one +of these calls returns false. The number of sets or maps in a union set or map can be obtained from @@ -2214,9 +2241,9 @@ To iterate over all the basic sets or maps in a set or map, use void *user), void *user); -The callback function C should return 0 if successful and --1 if an error occurs. In the latter case, or if any other error -occurs, the above functions will return -1. +The callback function C should return C if successful and +C if an error occurs. In the latter case, or if any other error +occurs, the above functions will return C. It should be noted that C does not guarantee that the basic sets or maps passed to C are disjoint. @@ -2273,9 +2300,10 @@ To iterate over the constraints of a basic set or map, use __isl_null isl_constraint *isl_constraint_free( __isl_take isl_constraint *c); -Again, the callback function C should return 0 if successful and --1 if an error occurs. In the latter case, or if any other error -occurs, the above functions will return -1. +Again, the callback function C should return C +if successful and +C if an error occurs. In the latter case, or if any other error +occurs, the above functions will return C. The constraint C represents either an equality or an inequality. Use the following function to find out whether a constraint represents an equality. If not, it represents an inequality. @@ -2424,11 +2452,11 @@ the following functions. The function C is called for each integer point in C with as second argument the last argument of the C call. The function C -should return C<0> on success and C<-1> on failure. +should return C on success and C on failure. In the latter case, C will stop -enumerating and return C<-1> as well. +enumerating and return C as well. If the enumeration is performed successfully and to completion, -then C returns C<0>. +then C returns C. To obtain a single point of a (basic or union) set, use @@ -2464,7 +2492,7 @@ parameters and set variables, addition, subtraction and integer division by an integer constant. For example, the quasi-affine expression - [n] -> { [x] -> [2*floor((4 n + x)/9] } + [n] -> { [x] -> [2*floor((4 n + x)/9)] } maps C to C<2*floor((4 n + x)/9>. A quasipolynomial is a polynomial expression in quasi-affine @@ -2474,7 +2502,7 @@ division of an expression involving multiplications. Here is an example of a quasipolynomial that is not quasi-affine expression - [n] -> { [x] -> (n*floor((4 n + x)/9) } + [n] -> { [x] -> (n*floor((4 n + x)/9)) } Note that the external representations of quasi-affine expressions and quasipolynomials are different. Quasi-affine expressions @@ -2500,7 +2528,7 @@ typically represent a failure to represent a result as a quasi-affine expression. The zero quasi affine expression or the quasi affine expression -that is equal to a given value or +that is equal to a given value, parameter or a specified dimension on a given domain can be created using #include @@ -2509,12 +2537,18 @@ a specified dimension on a given domain can be created using __isl_give isl_aff *isl_aff_val_on_domain( __isl_take isl_local_space *ls, __isl_take isl_val *val); + __isl_give isl_aff *isl_aff_param_on_domain_space_id( + __isl_take isl_space *space, + __isl_take isl_id *id); __isl_give isl_aff *isl_aff_var_on_domain( __isl_take isl_local_space *ls, enum isl_dim_type type, unsigned pos); __isl_give isl_aff *isl_aff_nan_on_domain( __isl_take isl_local_space *ls); +The space passed to C +is required to have a parameter with the given identifier. + Quasi affine expressions can be copied and freed using #include @@ -2842,7 +2876,7 @@ function. Similarly, a multiple union piecewise affine expression can be created from a multiple value with a given domain or -a multiple affine expression with a given domain +a (piecewise) multiple affine expression with a given domain using the following functions. #include @@ -2854,6 +2888,10 @@ using the following functions. isl_multi_union_pw_aff_multi_aff_on_domain( __isl_take isl_union_set *domain, __isl_take isl_multi_aff *ma); + __isl_give isl_multi_union_pw_aff * + isl_multi_union_pw_aff_pw_multi_aff_on_domain( + __isl_take isl_union_set *domain, + __isl_take isl_pw_multi_aff *pma); Multiple expressions can be copied and freed using the following functions. @@ -3147,8 +3185,8 @@ use the following functions. __isl_take isl_qpolynomial_fold *fold, void *user), void *user); -As usual, the function C should return C<0> on success -and C<-1> on failure. The difference between +As usual, the function C should return C on success +and C on failure. The difference between C and C is that C will first @@ -3266,16 +3304,29 @@ of the sets in the union set and collect the results. isl_union_pw_multi_aff_multi_val_on_domain( __isl_take isl_union_set *domain, __isl_take isl_multi_val *mv); + __isl_give isl_union_pw_aff * + isl_union_pw_aff_param_on_domain_id( + __isl_take isl_union_set *domain, + __isl_take isl_id *id); + +The C argument of C +is the identifier of a parameter that may or may not already +be present in C. An C that is equal to a (parametric) affine +or piecewise affine expression on a given domain can be created using the following -function. +functions. #include __isl_give isl_union_pw_aff * isl_union_pw_aff_aff_on_domain( __isl_take isl_union_set *domain, __isl_take isl_aff *aff); + __isl_give isl_union_pw_aff * + isl_union_pw_aff_pw_aff_on_domain( + __isl_take isl_union_set *domain, + __isl_take isl_pw_aff *pa); A base expression can be added to a union expression using the following functions. @@ -3794,6 +3845,7 @@ contains any integer points. The ``plain'' variants do not perform any computations, but simply check if the given set or relation is already known to be empty. + #include isl_bool isl_basic_set_plain_is_empty( __isl_keep isl_basic_set *bset); isl_bool isl_basic_set_is_empty( @@ -3801,8 +3853,12 @@ is already known to be empty. isl_bool isl_set_plain_is_empty( __isl_keep isl_set *set); isl_bool isl_set_is_empty(__isl_keep isl_set *set); + + #include isl_bool isl_union_set_is_empty( __isl_keep isl_union_set *uset); + + #include isl_bool isl_basic_map_plain_is_empty( __isl_keep isl_basic_map *bmap); isl_bool isl_basic_map_is_empty( @@ -3810,6 +3866,10 @@ is already known to be empty. isl_bool isl_map_plain_is_empty( __isl_keep isl_map *map); isl_bool isl_map_is_empty(__isl_keep isl_map *map); + + #include + isl_bool isl_union_map_plain_is_empty( + __isl_keep isl_union_map *umap); isl_bool isl_union_map_is_empty( __isl_keep isl_union_map *umap); @@ -3907,6 +3967,35 @@ C<*residue>. If the dimension does not attain only a single value and if no modulo can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>. + #include + __isl_give isl_stride_info *isl_set_get_stride_info( + __isl_keep isl_set *set, int pos); + __isl_give isl_val *isl_set_get_stride( + __isl_keep isl_set *set, int pos); + +Check if the values of the given set dimension are equal to +some affine expression of the other dimensions (the offset) +modulo some integer stride. +If no more specific information can be found, then the stride +is taken to be one and the offset is taken to be the zero expression. +The function C performs the same +computation but only returns the stride. +Otherwise, +the stride and offset can be extracted from the returned object +using the following functions. + + #include + __isl_give isl_val *isl_stride_info_get_stride( + __isl_keep isl_stride_info *si); + __isl_give isl_aff *isl_stride_info_get_offset( + __isl_keep isl_stride_info *si); + +The stride info object can be released using the following function. + + #include + __isl_null isl_stride_info *isl_stride_info_free( + __isl_take isl_stride_info *si); + =item * Dependence To check whether the description of a set, relation or function depends @@ -4436,6 +4525,9 @@ parameters. __isl_give isl_union_map *isl_union_map_project_out( __isl_take isl_union_map *umap, enum isl_dim_type type, unsigned first, unsigned n); + __isl_give isl_union_map * + isl_union_map_project_out_all_params( + __isl_take isl_union_map *umap); __isl_give isl_set *isl_union_map_params( __isl_take isl_union_map *umap); __isl_give isl_union_set *isl_union_map_domain( @@ -4449,9 +4541,15 @@ parameters. #include __isl_give isl_aff *isl_aff_project_domain_on_params( __isl_take isl_aff *aff); + __isl_give isl_multi_aff * + isl_multi_aff_project_domain_on_params( + __isl_take isl_multi_aff *ma); __isl_give isl_pw_aff * isl_pw_aff_project_domain_on_params( __isl_take isl_pw_aff *pa); + __isl_give isl_multi_pw_aff * + isl_multi_pw_aff_project_domain_on_params( + __isl_take isl_multi_pw_aff *mpa); __isl_give isl_pw_multi_aff * isl_pw_multi_aff_project_domain_on_params( __isl_take isl_pw_multi_aff *pma); @@ -4546,13 +4644,18 @@ without removing the dimensions. =item * Constructing a set from a parameter domain -A zero-dimensional space or (basic) set can be constructed +A zero-dimensional (local) space or (basic) set can be constructed on a given parameter domain using the following functions. #include __isl_give isl_space *isl_space_set_from_params( __isl_take isl_space *space); + #include + __isl_give isl_local_space * + isl_local_space_set_from_params( + __isl_take isl_local_space *ls); + #include __isl_give isl_basic_set *isl_basic_set_from_params( __isl_take isl_basic_set *bset); @@ -4588,6 +4691,10 @@ flat anonymous space. __isl_take isl_set *set); #include + __isl_give isl_union_map *isl_union_map_from_domain( + __isl_take isl_union_set *uset); + __isl_give isl_union_map *isl_union_map_from_range( + __isl_take isl_union_set *uset); __isl_give isl_union_map * isl_union_map_from_domain_and_range( __isl_take isl_union_set *domain, @@ -4598,6 +4705,8 @@ flat anonymous space. __isl_take isl_multi_val *mv); #include + __isl_give isl_aff *isl_aff_from_range( + __isl_take isl_aff *aff); __isl_give isl_multi_aff *isl_multi_aff_from_range( __isl_take isl_multi_aff *ma); __isl_give isl_pw_aff *isl_pw_aff_from_range( @@ -4663,6 +4772,11 @@ flat anonymous space. __isl_take isl_pw_qpolynomial *pwqp, enum isl_dim_type type, unsigned n, __isl_take isl_val *v); + __isl_give isl_pw_qpolynomial_fold * + isl_pw_qpolynomial_fold_fix_val( + __isl_take isl_pw_qpolynomial_fold *pwf, + enum isl_dim_type type, unsigned n, + __isl_take isl_val *v); Intersect the set, relation or function domain with the hyperplane where the given @@ -4758,6 +4872,18 @@ dimensions have opposite values. Intersect the relation with the half-space where the given dimensions satisfy the given ordering. + #include + __isl_give isl_union_map *isl_union_map_remove_map_if( + __isl_take isl_union_map *umap, + isl_bool (*fn)(__isl_keep isl_map *map, + void *user), void *user); + +This function calls the callback function once for each +pair of spaces for which there are elements in the input. +If the callback returns C, then all those elements +are removed from the result. The only remaining elements in the output +are then those for which the callback returns C. + =item * Locus #include @@ -5156,6 +5282,16 @@ 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_basic_set_dim_max_val( + __isl_take isl_basic_set *bset, int pos); + +Return the maximal value attained by the given set dimension, +independently of the parameter values and of any other dimensions. +The result is C in case of an error, the optimal value in case +there is one, infinity if the problem is unbounded and +NaN if the input is empty. + =item * Parametric optimization __isl_give isl_pw_aff *isl_set_dim_min( @@ -5301,6 +5437,12 @@ Remove any internal structure of domain (and range) of the given set or relation. If there is any such internal structure in the input, then the name of the space is also removed. + #include + __isl_give isl_space *isl_space_flatten_domain( + __isl_take isl_space *space); + __isl_give isl_space *isl_space_flatten_range( + __isl_take isl_space *space); + #include __isl_give isl_local_space * isl_local_space_flatten_domain( @@ -7648,10 +7790,14 @@ Vectors can be created, copied and freed using the following functions. #include __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx, unsigned size); + __isl_give isl_vec *isl_vec_zero(isl_ctx *ctx, + unsigned size); __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec); __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec); -Note that the elements of a newly created vector may have arbitrary values. +Note that the elements of a vector created by C +may have arbitrary values. +A vector created by C has elements with value zero. The elements can be changed and inspected using the following functions. int isl_vec_size(__isl_keep isl_vec *vec); @@ -7700,8 +7846,11 @@ The elements can be changed and inspected using the following functions. __isl_take isl_mat *mat, int row, int col, __isl_take isl_val *v); -C will return a negative value if anything went wrong. -In that case, the value of C<*v> is undefined. +The following function computes the rank of a matrix. +The return value may be -1 if some error occurred. + + #include + int isl_mat_rank(__isl_keep isl_mat *mat); The following function can be used to compute the (right) inverse of a matrix, i.e., a matrix such that the product of the original @@ -7716,6 +7865,29 @@ the original and the kernel (in that order) is the zero matrix. __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat); +The following function computes a basis for the space spanned +by the rows of a matrix. + + __isl_give isl_mat *isl_mat_row_basis( + __isl_take isl_mat *mat); + +The following function computes rows that extend a basis of C +to a basis that also covers C. + + __isl_give isl_mat *isl_mat_row_basis_extension( + __isl_take isl_mat *mat1, + __isl_take isl_mat *mat2); + +The following function checks whether there is no linear dependence +among the combined rows of "mat1" and "mat2" that is not already present +in "mat1" or "mat2" individually. +If "mat1" and "mat2" have linearly independent rows by themselves, +then this means that there is no linear dependence among all rows together. + + isl_bool isl_mat_has_linearly_independent_rows( + __isl_keep isl_mat *mat1, + __isl_keep isl_mat *mat2); + =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions The following functions determine @@ -7906,6 +8078,8 @@ active domain elements for which an AST needs to be generated. The conditions under which some domain elements are still active may however not be completely described by the outer AST nodes generated at that point. +Since an extension node references the outer band nodes, any tree +containing an extension node is considered to be anchored. An extension node may also appear as the root of a schedule tree, when it is intended to be inserted into another tree @@ -7921,6 +8095,8 @@ The guard describes constraints on the parameters and the schedule dimensions of outer bands that need to be enforced by the outer nodes in the generated AST. +That is, the part of the AST that is generated from descendants +of the guard node can assume that these constraints are satisfied. The space of the guard is that of the flat product of the outer band nodes. In particular, if there are no outer band nodes, then this space is the unnamed zero-dimensional space. @@ -8104,7 +8280,7 @@ C prints the schedule in flow format. The schedule tree can be traversed through the use of C objects that point to a particular position in the schedule tree. Whenever a C -is use to modify a node in the schedule tree, the original schedule +is used to modify a node in the schedule tree, the original schedule tree is left untouched and the modifications are performed to a copy of the tree. The returned C then points to this modified copy of the tree. @@ -8246,6 +8422,16 @@ of the given node should be visited. In particular, if the callback returns a positive value, then the children are visited, but if the callback returns zero, then the children are not visited. +The following functions checks whether +all descendants of a specific node (including the node itself) +satisfy a user-specified test. + + #include + isl_bool isl_schedule_node_every_descendant( + __isl_keep isl_schedule_node *node, + isl_bool (*test)(__isl_keep isl_schedule_node *node, + void *user), void *user) + The ancestors of a node in a schedule tree can be visited from the root down to and including the parent of the node using the following function. @@ -8695,7 +8881,7 @@ The resulting outer band node contains the first C dimensions of the schedule of C while the inner band contains the remaining dimensions. The schedules of the two band nodes live in anonymous spaces. The loop AST generation type options and the isolate option -are split over the the two band nodes. +are split over the two band nodes. A band node can be moved down to the leaves of the subtree rooted at the band node using the following function. @@ -9248,7 +9434,7 @@ considered adjacent to each other if the entire wrapped relation matches. In particular, a relation with a tag will never be considered adjacent to a relation without a tag. -The function C takes +The function C takes schedule constraints that are defined on some set of domain elements and transforms them to schedule constraints on the elements to which these domain elements are mapped by the given transformation. @@ -10449,7 +10635,7 @@ They can be set using the following function. #include __isl_give isl_ast_build * isl_ast_build_set_options( - __isl_take isl_ast_build *control, + __isl_take isl_ast_build *build, __isl_take isl_union_map *options); The options are encoded in an C. @@ -10639,7 +10825,7 @@ Additional control is available through the following functions. #include __isl_give isl_ast_build * isl_ast_build_set_iterators( - __isl_take isl_ast_build *control, + __isl_take isl_ast_build *build, __isl_take isl_id_list *iterators); The function C allows the user to @@ -10657,7 +10843,7 @@ names are automatically generated. #include __isl_give isl_ast_build * isl_ast_build_set_create_leaf( - __isl_take isl_ast_build *control, + __isl_take isl_ast_build *build, __isl_give isl_ast_node *(*fn)( __isl_take isl_ast_build *build, void *user), void *user); @@ -10740,7 +10926,7 @@ pre-order, while the second will be called in depth-first post-order. Since the callback set by C is called before the mark AST node is actually constructed, it is passed the identifier of the mark node. -All callbacks should C (or -1) on failure. +All callbacks should C (or C) on failure. The given C can be used to create new C objects using C or C. diff --git a/polly/lib/External/isl/include/isl/aff.h b/polly/lib/External/isl/include/isl/aff.h index b032ab11ef20..fd7c89dbfd51 100644 --- a/polly/lib/External/isl/include/isl/aff.h +++ b/polly/lib/External/isl/include/isl/aff.h @@ -20,6 +20,8 @@ __isl_give isl_aff *isl_aff_val_on_domain(__isl_take isl_local_space *ls, __isl_give isl_aff *isl_aff_var_on_domain(__isl_take isl_local_space *ls, enum isl_dim_type type, unsigned pos); __isl_give isl_aff *isl_aff_nan_on_domain(__isl_take isl_local_space *ls); +__isl_give isl_aff *isl_aff_param_on_domain_space_id( + __isl_take isl_space *space, __isl_take isl_id *id); __isl_give isl_aff *isl_aff_copy(__isl_keep isl_aff *aff); __isl_null isl_aff *isl_aff_free(__isl_take isl_aff *aff); @@ -80,6 +82,8 @@ isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff); __isl_give isl_aff *isl_aff_get_div(__isl_keep isl_aff *aff, int pos); +__isl_give isl_aff *isl_aff_from_range(__isl_take isl_aff *aff); + __isl_export __isl_give isl_aff *isl_aff_neg(__isl_take isl_aff *aff); __isl_export @@ -636,6 +640,8 @@ __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_from_domain( __isl_take isl_union_set *uset); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_multi_val_on_domain( __isl_take isl_union_set *domain, __isl_take isl_multi_val *mv); +__isl_give isl_union_pw_aff *isl_union_pw_aff_param_on_domain_id( + __isl_take isl_union_set *domain, __isl_take isl_id *id); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_copy( __isl_keep isl_union_pw_multi_aff *upma); __isl_null isl_union_pw_multi_aff *isl_union_pw_multi_aff_free( @@ -861,6 +867,8 @@ __isl_give isl_union_pw_aff *isl_union_pw_aff_val_on_domain( __isl_take isl_union_set *domain, __isl_take isl_val *v); __isl_give isl_union_pw_aff *isl_union_pw_aff_aff_on_domain( __isl_take isl_union_set *domain, __isl_take isl_aff *aff); +__isl_give isl_union_pw_aff *isl_union_pw_aff_pw_aff_on_domain( + __isl_take isl_union_set *domain, __isl_take isl_pw_aff *pa); __isl_give isl_union_pw_aff *isl_union_pw_aff_add_pw_aff( __isl_take isl_union_pw_aff *upa, __isl_take isl_pw_aff *pa); @@ -959,6 +967,9 @@ __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_multi_val_on_domain( __isl_take isl_union_set *domain, __isl_take isl_multi_val *mv); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_multi_aff_on_domain( __isl_take isl_union_set *domain, __isl_take isl_multi_aff *ma); +__isl_give isl_multi_union_pw_aff * +isl_multi_union_pw_aff_pw_multi_aff_on_domain(__isl_take isl_union_set *domain, + __isl_take isl_pw_multi_aff *pma); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_floor( __isl_take isl_multi_union_pw_aff *mupa); diff --git a/polly/lib/External/isl/include/isl/band.h b/polly/lib/External/isl/include/isl/band.h deleted file mode 100644 index 6dd19ba8f02e..000000000000 --- a/polly/lib/External/isl/include/isl/band.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef ISL_BAND_H -#define ISL_BAND_H - -#include -#include -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -struct isl_band; -typedef struct isl_band isl_band; - -ISL_DECLARE_LIST(band) - -__isl_give isl_band *isl_band_copy(__isl_keep isl_band *band); -__isl_null isl_band *isl_band_free(__isl_take isl_band *band); - -isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band); - -int isl_band_has_children(__isl_keep isl_band *band); -__isl_give isl_band_list *isl_band_get_children( - __isl_keep isl_band *band); - -__isl_give isl_union_map *isl_band_get_prefix_schedule( - __isl_keep isl_band *band); -__isl_give isl_union_map *isl_band_get_partial_schedule( - __isl_keep isl_band *band); -__isl_give isl_union_map *isl_band_get_suffix_schedule( - __isl_keep isl_band *band); - -isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx, int val); -int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx); -isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx, int val); -int isl_options_get_tile_shift_point_loops(isl_ctx *ctx); - -int isl_band_tile(__isl_keep isl_band *band, __isl_take isl_vec *sizes); -int isl_band_split(__isl_keep isl_band *band, int pos); - -int isl_band_n_member(__isl_keep isl_band *band); -int isl_band_member_is_coincident(__isl_keep isl_band *band, int pos); - -int isl_band_list_foreach_band(__isl_keep isl_band_list *list, - int (*fn)(__isl_keep isl_band *band, void *user), void *user); - -__isl_give isl_printer *isl_printer_print_band(__isl_take isl_printer *p, - __isl_keep isl_band *band); -void isl_band_dump(__isl_keep isl_band *band); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/polly/lib/External/isl/include/isl/constraint.h b/polly/lib/External/isl/include/isl/constraint.h index 92fa029911f9..73053b95c98f 100644 --- a/polly/lib/External/isl/include/isl/constraint.h +++ b/polly/lib/External/isl/include/isl/constraint.h @@ -36,7 +36,6 @@ __isl_give isl_constraint *isl_constraint_alloc_inequality( __isl_give isl_constraint *isl_equality_alloc(__isl_take isl_local_space *ls); __isl_give isl_constraint *isl_inequality_alloc(__isl_take isl_local_space *ls); -struct isl_constraint *isl_constraint_cow(struct isl_constraint *c); struct isl_constraint *isl_constraint_copy(struct isl_constraint *c); __isl_null isl_constraint *isl_constraint_free(__isl_take isl_constraint *c); diff --git a/polly/lib/External/isl/include/isl/ctx.h b/polly/lib/External/isl/include/isl/ctx.h index 7c925233952d..13c98c84738a 100644 --- a/polly/lib/External/isl/include/isl/ctx.h +++ b/polly/lib/External/isl/include/isl/ctx.h @@ -248,6 +248,9 @@ isl_stat prefix ## _set_ ## field(isl_ctx *ctx, const char *val) \ ISL_CTX_SET_INT_DEF(prefix,st,args,field) enum isl_error isl_ctx_last_error(isl_ctx *ctx); +const char *isl_ctx_last_error_msg(isl_ctx *ctx); +const char *isl_ctx_last_error_file(isl_ctx *ctx); +int isl_ctx_last_error_line(isl_ctx *ctx); void isl_ctx_reset_error(isl_ctx *ctx); void isl_ctx_set_error(isl_ctx *ctx, enum isl_error error); diff --git a/polly/lib/External/isl/include/isl/deprecated/aff_int.h b/polly/lib/External/isl/include/isl/deprecated/aff_int.h deleted file mode 100644 index a0673747187a..000000000000 --- a/polly/lib/External/isl/include/isl/deprecated/aff_int.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef ISL_DEPRECATED_AFF_INT_H -#define ISL_DEPRECATED_AFF_INT_H - -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -int isl_aff_get_constant(__isl_keep isl_aff *aff, isl_int *v); -int isl_aff_get_coefficient(__isl_keep isl_aff *aff, - enum isl_dim_type type, int pos, isl_int *v); -isl_stat isl_aff_get_denominator(__isl_keep isl_aff *aff, isl_int *v); -__isl_give isl_aff *isl_aff_set_constant(__isl_take isl_aff *aff, isl_int v); -__isl_give isl_aff *isl_aff_set_coefficient(__isl_take isl_aff *aff, - enum isl_dim_type type, int pos, isl_int v); -__isl_give isl_aff *isl_aff_set_denominator(__isl_take isl_aff *aff, isl_int v); -__isl_give isl_aff *isl_aff_add_constant(__isl_take isl_aff *aff, isl_int v); -__isl_give isl_aff *isl_aff_add_constant_num(__isl_take isl_aff *aff, - isl_int v); -__isl_give isl_aff *isl_aff_add_coefficient(__isl_take isl_aff *aff, - enum isl_dim_type type, int pos, isl_int v); - -__isl_give isl_aff *isl_aff_mod(__isl_take isl_aff *aff, isl_int mod); - -__isl_give isl_aff *isl_aff_scale(__isl_take isl_aff *aff, isl_int f); -__isl_give isl_aff *isl_aff_scale_down(__isl_take isl_aff *aff, isl_int f); - -__isl_give isl_pw_aff *isl_pw_aff_mod(__isl_take isl_pw_aff *pwaff, - isl_int mod); - -__isl_give isl_pw_aff *isl_pw_aff_scale(__isl_take isl_pw_aff *pwaff, - isl_int f); -__isl_give isl_pw_aff *isl_pw_aff_scale_down(__isl_take isl_pw_aff *pwaff, - isl_int f); - -__isl_give isl_multi_aff *isl_multi_aff_scale(__isl_take isl_multi_aff *maff, - isl_int f); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/polly/lib/External/isl/include/isl/deprecated/ast_int.h b/polly/lib/External/isl/include/isl/deprecated/ast_int.h deleted file mode 100644 index 7d2039be0a5d..000000000000 --- a/polly/lib/External/isl/include/isl/deprecated/ast_int.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef ISL_DEPRECATED_AST_INT_H -#define ISL_DEPRECATED_AST_INT_H - -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -int isl_ast_expr_get_int(__isl_keep isl_ast_expr *expr, isl_int *v); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/polly/lib/External/isl/include/isl/deprecated/constraint_int.h b/polly/lib/External/isl/include/isl/deprecated/constraint_int.h deleted file mode 100644 index c5ab0aabc41c..000000000000 --- a/polly/lib/External/isl/include/isl/deprecated/constraint_int.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef ISL_DEPRECATED_CONSTRAINT_INT_H -#define ISL_DEPRECATED_CONSTRAINT_INT_H - -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -void isl_constraint_get_constant(__isl_keep isl_constraint *constraint, - isl_int *v); -void isl_constraint_get_coefficient(__isl_keep isl_constraint *constraint, - enum isl_dim_type type, int pos, isl_int *v); -__isl_give isl_constraint *isl_constraint_set_constant( - __isl_take isl_constraint *constraint, isl_int v); -__isl_give isl_constraint *isl_constraint_set_coefficient( - __isl_take isl_constraint *constraint, - enum isl_dim_type type, int pos, isl_int v); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/polly/lib/External/isl/include/isl/deprecated/ilp_int.h b/polly/lib/External/isl/include/isl/deprecated/ilp_int.h deleted file mode 100644 index b952e1b17acb..000000000000 --- a/polly/lib/External/isl/include/isl/deprecated/ilp_int.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef ISL_DEPRECATED_ILP_INT_H -#define ISL_DEPRECATED_ILP_INT_H - -#include -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -enum isl_lp_result isl_basic_set_max(__isl_keep isl_basic_set *bset, - __isl_keep isl_aff *obj, isl_int *opt); -enum isl_lp_result isl_set_min(__isl_keep isl_set *set, - __isl_keep isl_aff *obj, isl_int *opt); -enum isl_lp_result isl_set_max(__isl_keep isl_set *set, - __isl_keep isl_aff *obj, isl_int *opt); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/polly/lib/External/isl/include/isl/deprecated/int.h b/polly/lib/External/isl/include/isl/deprecated/int.h deleted file mode 100644 index 987823461928..000000000000 --- a/polly/lib/External/isl/include/isl/deprecated/int.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2008-2009 Katholieke Universiteit Leuven - * - * Use of this software is governed by the MIT license - * - * Written by Sven Verdoolaege, K.U.Leuven, Departement - * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium - */ - -#ifndef ISL_DEPRECATED_INT_H -#define ISL_DEPRECATED_INT_H - -#include -#include -#include -#if defined(__cplusplus) -#include -#endif - -#if defined(__cplusplus) -extern "C" { -#endif - -#ifndef mp_get_memory_functions -void mp_get_memory_functions( - void *(**alloc_func_ptr) (size_t), - void *(**realloc_func_ptr) (void *, size_t, size_t), - void (**free_func_ptr) (void *, size_t)); -#endif - -/* isl_int is the basic integer type. It currently always corresponds - * to a gmp mpz_t, but in the future, different types such as long long - * or cln::cl_I will be supported. - */ -typedef mpz_t isl_int; - -#define isl_int_init(i) mpz_init(i) -#define isl_int_clear(i) mpz_clear(i) - -#define isl_int_set(r,i) mpz_set(r,i) -#define isl_int_set_gmp(r,i) mpz_set(r,i) -#define isl_int_set_si(r,i) mpz_set_si(r,i) -#define isl_int_set_ui(r,i) mpz_set_ui(r,i) -#define isl_int_get_gmp(i,g) mpz_set(g,i) -#define isl_int_get_si(r) mpz_get_si(r) -#define isl_int_get_ui(r) mpz_get_ui(r) -#define isl_int_get_d(r) mpz_get_d(r) -#define isl_int_get_str(r) mpz_get_str(0, 10, r) -typedef void (*isl_int_print_gmp_free_t)(void *, size_t); -#define isl_int_free_str(s) \ - do { \ - isl_int_print_gmp_free_t gmp_free; \ - mp_get_memory_functions(NULL, NULL, &gmp_free); \ - (*gmp_free)(s, strlen(s) + 1); \ - } while (0) -#define isl_int_abs(r,i) mpz_abs(r,i) -#define isl_int_neg(r,i) mpz_neg(r,i) -#define isl_int_swap(i,j) mpz_swap(i,j) -#define isl_int_swap_or_set(i,j) mpz_swap(i,j) -#define isl_int_add_ui(r,i,j) mpz_add_ui(r,i,j) -#define isl_int_sub_ui(r,i,j) mpz_sub_ui(r,i,j) - -#define isl_int_add(r,i,j) mpz_add(r,i,j) -#define isl_int_sub(r,i,j) mpz_sub(r,i,j) -#define isl_int_mul(r,i,j) mpz_mul(r,i,j) -#define isl_int_mul_2exp(r,i,j) mpz_mul_2exp(r,i,j) -#define isl_int_mul_ui(r,i,j) mpz_mul_ui(r,i,j) -#define isl_int_pow_ui(r,i,j) mpz_pow_ui(r,i,j) -#define isl_int_addmul(r,i,j) mpz_addmul(r,i,j) -#define isl_int_submul(r,i,j) mpz_submul(r,i,j) - -#define isl_int_gcd(r,i,j) mpz_gcd(r,i,j) -#define isl_int_lcm(r,i,j) mpz_lcm(r,i,j) -#define isl_int_divexact(r,i,j) mpz_divexact(r,i,j) -#define isl_int_divexact_ui(r,i,j) mpz_divexact_ui(r,i,j) -#define isl_int_tdiv_q(r,i,j) mpz_tdiv_q(r,i,j) -#define isl_int_cdiv_q(r,i,j) mpz_cdiv_q(r,i,j) -#define isl_int_fdiv_q(r,i,j) mpz_fdiv_q(r,i,j) -#define isl_int_fdiv_r(r,i,j) mpz_fdiv_r(r,i,j) -#define isl_int_fdiv_q_ui(r,i,j) mpz_fdiv_q_ui(r,i,j) - -#define isl_int_read(r,s) mpz_set_str(r,s,10) -#define isl_int_print(out,i,width) \ - do { \ - char *s; \ - s = mpz_get_str(0, 10, i); \ - fprintf(out, "%*s", width, s); \ - isl_int_free_str(s); \ - } while (0) - -#define isl_int_sgn(i) mpz_sgn(i) -#define isl_int_cmp(i,j) mpz_cmp(i,j) -#define isl_int_cmp_si(i,si) mpz_cmp_si(i,si) -#define isl_int_eq(i,j) (mpz_cmp(i,j) == 0) -#define isl_int_ne(i,j) (mpz_cmp(i,j) != 0) -#define isl_int_lt(i,j) (mpz_cmp(i,j) < 0) -#define isl_int_le(i,j) (mpz_cmp(i,j) <= 0) -#define isl_int_gt(i,j) (mpz_cmp(i,j) > 0) -#define isl_int_ge(i,j) (mpz_cmp(i,j) >= 0) -#define isl_int_abs_eq(i,j) (mpz_cmpabs(i,j) == 0) -#define isl_int_abs_ne(i,j) (mpz_cmpabs(i,j) != 0) -#define isl_int_abs_lt(i,j) (mpz_cmpabs(i,j) < 0) -#define isl_int_abs_gt(i,j) (mpz_cmpabs(i,j) > 0) -#define isl_int_abs_ge(i,j) (mpz_cmpabs(i,j) >= 0) - - -#define isl_int_is_zero(i) (isl_int_sgn(i) == 0) -#define isl_int_is_one(i) (isl_int_cmp_si(i,1) == 0) -#define isl_int_is_negone(i) (isl_int_cmp_si(i,-1) == 0) -#define isl_int_is_pos(i) (isl_int_sgn(i) > 0) -#define isl_int_is_neg(i) (isl_int_sgn(i) < 0) -#define isl_int_is_nonpos(i) (isl_int_sgn(i) <= 0) -#define isl_int_is_nonneg(i) (isl_int_sgn(i) >= 0) -#define isl_int_is_divisible_by(i,j) mpz_divisible_p(i,j) - -uint32_t isl_gmp_hash(mpz_t v, uint32_t hash); -#define isl_int_hash(v,h) isl_gmp_hash(v,h) - -#if defined(__cplusplus) -} -#endif - -#if defined(__cplusplus) -extern "C" { typedef void (*isl_gmp_free_t)(void *, size_t); } - -static inline std::ostream &operator<<(std::ostream &os, isl_int i) -{ - char *s; - s = mpz_get_str(0, 10, i); - os << s; - isl_int_free_str(s); - return os; -} -#endif - -#endif diff --git a/polly/lib/External/isl/include/isl/deprecated/map_int.h b/polly/lib/External/isl/include/isl/deprecated/map_int.h deleted file mode 100644 index c120c40e81af..000000000000 --- a/polly/lib/External/isl/include/isl/deprecated/map_int.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef ISL_DEPRECATED_MAP_INT_H -#define ISL_DEPRECATED_MAP_INT_H - -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -isl_bool isl_basic_map_plain_is_fixed(__isl_keep isl_basic_map *bmap, - enum isl_dim_type type, unsigned pos, isl_int *val); - -__isl_give isl_map *isl_map_fix(__isl_take isl_map *map, - enum isl_dim_type type, unsigned pos, isl_int value); -isl_bool isl_map_plain_is_fixed(__isl_keep isl_map *map, - enum isl_dim_type type, unsigned pos, isl_int *val); - -__isl_give isl_map *isl_map_fixed_power(__isl_take isl_map *map, isl_int exp); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/polly/lib/External/isl/include/isl/deprecated/mat_int.h b/polly/lib/External/isl/include/isl/deprecated/mat_int.h deleted file mode 100644 index efacd4e58826..000000000000 --- a/polly/lib/External/isl/include/isl/deprecated/mat_int.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef ISL_DEPRECATED_MAT_INT_H -#define ISL_DEPRECATED_MAT_INT_H - -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -int isl_mat_get_element(__isl_keep isl_mat *mat, int row, int col, isl_int *v); -__isl_give isl_mat *isl_mat_set_element(__isl_take isl_mat *mat, - int row, int col, isl_int v); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/polly/lib/External/isl/include/isl/deprecated/point_int.h b/polly/lib/External/isl/include/isl/deprecated/point_int.h deleted file mode 100644 index 2e1a98b6d6f8..000000000000 --- a/polly/lib/External/isl/include/isl/deprecated/point_int.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef ISL_DEPRECATED_POINT_INT_H -#define ISL_DEPRECATED_POINT_INT_H - -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -int isl_point_get_coordinate(__isl_keep isl_point *pnt, - enum isl_dim_type type, int pos, isl_int *v); -__isl_give isl_point *isl_point_set_coordinate(__isl_take isl_point *pnt, - enum isl_dim_type type, int pos, isl_int v); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/polly/lib/External/isl/include/isl/deprecated/polynomial_int.h b/polly/lib/External/isl/include/isl/deprecated/polynomial_int.h deleted file mode 100644 index b86fcf29f48a..000000000000 --- a/polly/lib/External/isl/include/isl/deprecated/polynomial_int.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef ISL_DEPRECATED_POLYNOMIAL_INT_H -#define ISL_DEPRECATED_POLYNOMIAL_INT_H - -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -__isl_give isl_qpolynomial *isl_qpolynomial_rat_cst_on_domain( - __isl_take isl_space *space, const isl_int n, const isl_int d); -int isl_qpolynomial_is_cst(__isl_keep isl_qpolynomial *qp, - isl_int *n, isl_int *d); -__isl_give isl_qpolynomial *isl_qpolynomial_scale( - __isl_take isl_qpolynomial *qp, isl_int v); - -void isl_term_get_num(__isl_keep isl_term *term, isl_int *n); -void isl_term_get_den(__isl_keep isl_term *term, isl_int *d); - -__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_scale( - __isl_take isl_qpolynomial_fold *fold, isl_int v); - -__isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fix_dim( - __isl_take isl_pw_qpolynomial_fold *pwf, - enum isl_dim_type type, unsigned n, isl_int v); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/polly/lib/External/isl/include/isl/deprecated/set_int.h b/polly/lib/External/isl/include/isl/deprecated/set_int.h deleted file mode 100644 index 6f9ed068eb49..000000000000 --- a/polly/lib/External/isl/include/isl/deprecated/set_int.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef ISL_DEPRECATED_SET_INT_H -#define ISL_DEPRECATED_SET_INT_H - -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -__isl_give isl_basic_set *isl_basic_set_fix(__isl_take isl_basic_set *bset, - enum isl_dim_type type, unsigned pos, isl_int value); -__isl_give isl_set *isl_set_lower_bound(__isl_take isl_set *set, - enum isl_dim_type type, unsigned pos, isl_int value); -__isl_give isl_set *isl_set_upper_bound(__isl_take isl_set *set, - enum isl_dim_type type, unsigned pos, isl_int value); -__isl_give isl_set *isl_set_fix(__isl_take isl_set *set, - enum isl_dim_type type, unsigned pos, isl_int value); - -isl_bool isl_set_plain_is_fixed(__isl_keep isl_set *set, - enum isl_dim_type type, unsigned pos, isl_int *val); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/polly/lib/External/isl/include/isl/deprecated/union_map_int.h b/polly/lib/External/isl/include/isl/deprecated/union_map_int.h deleted file mode 100644 index 4a57997a91f3..000000000000 --- a/polly/lib/External/isl/include/isl/deprecated/union_map_int.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef ISL_DEPRECATED_UNION_MAP_INT_H -#define ISL_DEPRECATED_UNION_MAP_INT_H - -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -__isl_give isl_union_map *isl_union_map_fixed_power( - __isl_take isl_union_map *umap, isl_int exp); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/polly/lib/External/isl/include/isl/deprecated/val_int.h b/polly/lib/External/isl/include/isl/deprecated/val_int.h deleted file mode 100644 index ef2eba221d2f..000000000000 --- a/polly/lib/External/isl/include/isl/deprecated/val_int.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef ISL_DEPRECATED_VAL_INT_H -#define ISL_DEPRECATED_VAL_INT_H - -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -__isl_give isl_val *isl_val_int_from_isl_int(isl_ctx *ctx, isl_int n); -int isl_val_get_num_isl_int(__isl_keep isl_val *v, isl_int *n); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/polly/lib/External/isl/include/isl/deprecated/vec_int.h b/polly/lib/External/isl/include/isl/deprecated/vec_int.h deleted file mode 100644 index c072997ac0f8..000000000000 --- a/polly/lib/External/isl/include/isl/deprecated/vec_int.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef ISL_DEPRECATED_VEC_INT_H -#define ISL_DEPRECATED_VEC_INT_H - -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -int isl_vec_get_element(__isl_keep isl_vec *vec, int pos, isl_int *v); -__isl_give isl_vec *isl_vec_set_element(__isl_take isl_vec *vec, - int pos, isl_int v); - -__isl_give isl_vec *isl_vec_set(__isl_take isl_vec *vec, isl_int v); -__isl_give isl_vec *isl_vec_fdiv_r(__isl_take isl_vec *vec, isl_int m); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/polly/lib/External/isl/include/isl/ilp.h b/polly/lib/External/isl/include/isl/ilp.h index 2b8898ba21f8..d93c59206b81 100644 --- a/polly/lib/External/isl/include/isl/ilp.h +++ b/polly/lib/External/isl/include/isl/ilp.h @@ -31,6 +31,10 @@ __isl_give isl_val *isl_set_max_val(__isl_keep isl_set *set, __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_export +__isl_give isl_val *isl_basic_set_dim_max_val(__isl_take isl_basic_set *bset, + int pos); + #if defined(__cplusplus) } #endif diff --git a/polly/lib/External/isl/include/isl/local_space.h b/polly/lib/External/isl/include/isl/local_space.h index 5ad832997184..d0fc960b3978 100644 --- a/polly/lib/External/isl/include/isl/local_space.h +++ b/polly/lib/External/isl/include/isl/local_space.h @@ -66,6 +66,8 @@ __isl_give isl_local_space *isl_local_space_drop_dims( __isl_give isl_local_space *isl_local_space_insert_dims( __isl_take isl_local_space *ls, enum isl_dim_type type, unsigned first, unsigned n); +__isl_give isl_local_space *isl_local_space_set_from_params( + __isl_take isl_local_space *ls); __isl_give isl_local_space *isl_local_space_intersect( __isl_take isl_local_space *ls1, __isl_take isl_local_space *ls2); diff --git a/polly/lib/External/isl/include/isl/map.h b/polly/lib/External/isl/include/isl/map.h index a4e65335e625..0ff17fe5e7ba 100644 --- a/polly/lib/External/isl/include/isl/map.h +++ b/polly/lib/External/isl/include/isl/map.h @@ -119,8 +119,8 @@ __isl_give isl_basic_map *isl_basic_map_less_at(__isl_take isl_space *dim, unsigned pos); __isl_give isl_basic_map *isl_basic_map_more_at(__isl_take isl_space *dim, unsigned pos); -__isl_give isl_basic_map *isl_basic_map_empty(__isl_take isl_space *dim); -__isl_give isl_basic_map *isl_basic_map_universe(__isl_take isl_space *dim); +__isl_give isl_basic_map *isl_basic_map_empty(__isl_take isl_space *space); +__isl_give isl_basic_map *isl_basic_map_universe(__isl_take isl_space *space); __isl_give isl_basic_map *isl_basic_map_nat_universe(__isl_take isl_space *dim); __isl_give isl_basic_map *isl_basic_map_remove_redundancies( __isl_take isl_basic_map *bmap); @@ -281,9 +281,9 @@ isl_bool isl_basic_map_is_subset(__isl_keep isl_basic_map *bmap1, isl_bool isl_basic_map_is_strict_subset(__isl_keep isl_basic_map *bmap1, __isl_keep isl_basic_map *bmap2); -__isl_give isl_map *isl_map_universe(__isl_take isl_space *dim); +__isl_give isl_map *isl_map_universe(__isl_take isl_space *space); __isl_give isl_map *isl_map_nat_universe(__isl_take isl_space *dim); -__isl_give isl_map *isl_map_empty(__isl_take isl_space *dim); +__isl_give isl_map *isl_map_empty(__isl_take isl_space *space); __isl_give isl_map *isl_map_identity(__isl_take isl_space *dim); __isl_give isl_map *isl_map_lex_lt_first(__isl_take isl_space *dim, unsigned n); __isl_give isl_map *isl_map_lex_le_first(__isl_take isl_space *dim, unsigned n); diff --git a/polly/lib/External/isl/include/isl/mat.h b/polly/lib/External/isl/include/isl/mat.h index 8764c96f3658..9fef0e93b45d 100644 --- a/polly/lib/External/isl/include/isl/mat.h +++ b/polly/lib/External/isl/include/isl/mat.h @@ -27,12 +27,10 @@ isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat); __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx, unsigned n_row, unsigned n_col); -__isl_give isl_mat *isl_mat_dup(__isl_keep isl_mat *mat); struct isl_mat *isl_mat_extend(struct isl_mat *mat, unsigned n_row, unsigned n_col); struct isl_mat *isl_mat_identity(struct isl_ctx *ctx, unsigned n_row); __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat); -__isl_give isl_mat *isl_mat_cow(__isl_take isl_mat *mat); __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat); int isl_mat_rows(__isl_keep isl_mat *mat); @@ -94,6 +92,9 @@ __isl_give isl_mat *isl_mat_add_zero_rows(__isl_take isl_mat *mat, unsigned n); void isl_mat_col_add(__isl_keep isl_mat *mat, int dst_col, int src_col); __isl_give isl_mat *isl_mat_unimodular_complete(__isl_take isl_mat *M, int row); +__isl_give isl_mat *isl_mat_row_basis(__isl_take isl_mat *mat); +__isl_give isl_mat *isl_mat_row_basis_extension( + __isl_take isl_mat *mat1, __isl_take isl_mat *mat2); __isl_give isl_mat *isl_mat_from_row_vec(__isl_take isl_vec *vec); __isl_give isl_mat *isl_mat_concat(__isl_take isl_mat *top, @@ -102,7 +103,10 @@ __isl_give isl_mat *isl_mat_vec_concat(__isl_take isl_mat *top, __isl_take isl_vec *bot); isl_bool isl_mat_is_equal(__isl_keep isl_mat *mat1, __isl_keep isl_mat *mat2); +isl_bool isl_mat_has_linearly_independent_rows(__isl_keep isl_mat *mat1, + __isl_keep isl_mat *mat2); +int isl_mat_rank(__isl_keep isl_mat *mat); int isl_mat_initial_non_zero_cols(__isl_keep isl_mat *mat); void isl_mat_print_internal(__isl_keep isl_mat *mat, FILE *out, int indent); diff --git a/polly/lib/External/isl/include/isl/multi.h b/polly/lib/External/isl/include/isl/multi.h index a678b3296cfa..bccc0312e3f4 100644 --- a/polly/lib/External/isl/include/isl/multi.h +++ b/polly/lib/External/isl/include/isl/multi.h @@ -38,7 +38,7 @@ int isl_multi_##BASE##_find_dim_by_id( \ __isl_keep isl_multi_##BASE *multi, enum isl_dim_type type, \ __isl_keep isl_id *id); \ __isl_give isl_id *isl_multi_##BASE##_get_dim_id( \ - __isl_take isl_multi_##BASE *multi, \ + __isl_keep isl_multi_##BASE *multi, \ enum isl_dim_type type, unsigned pos); \ __isl_give isl_multi_##BASE *isl_multi_##BASE##_set_dim_name( \ __isl_take isl_multi_##BASE *multi, \ @@ -134,7 +134,10 @@ __isl_give isl_multi_##BASE *isl_multi_##BASE##_insert_dims( \ unsigned first, unsigned n); \ __isl_give isl_multi_##BASE *isl_multi_##BASE##_add_dims( \ __isl_take isl_multi_##BASE *multi, enum isl_dim_type type, \ - unsigned n); + unsigned n); \ +__isl_give isl_multi_##BASE * \ +isl_multi_##BASE##_project_domain_on_params( \ + __isl_take isl_multi_##BASE *multi); #define ISL_DECLARE_MULTI_WITH_DOMAIN(BASE) \ __isl_export \ diff --git a/polly/lib/External/isl/include/isl/polynomial.h b/polly/lib/External/isl/include/isl/polynomial.h index bb285ab1845d..72b015d2d460 100644 --- a/polly/lib/External/isl/include/isl/polynomial.h +++ b/polly/lib/External/isl/include/isl/polynomial.h @@ -316,6 +316,10 @@ __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_substitute( enum isl_dim_type type, unsigned first, unsigned n, __isl_keep isl_qpolynomial **subs); +__isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fix_val( + __isl_take isl_pw_qpolynomial_fold *pwf, + enum isl_dim_type type, unsigned n, __isl_take isl_val *v); + __isl_give isl_val *isl_qpolynomial_fold_eval( __isl_take isl_qpolynomial_fold *fold, __isl_take isl_point *pnt); diff --git a/polly/lib/External/isl/include/isl/schedule.h b/polly/lib/External/isl/include/isl/schedule.h index 7970b6475414..b74d5ac6f985 100644 --- a/polly/lib/External/isl/include/isl/schedule.h +++ b/polly/lib/External/isl/include/isl/schedule.h @@ -5,10 +5,10 @@ #include #include #include -#include #include #include #include +#include #if defined(__cplusplus) extern "C" { @@ -183,9 +183,6 @@ __isl_give isl_schedule *isl_schedule_expand(__isl_take isl_schedule *schedule, __isl_take isl_union_pw_multi_aff *contraction, __isl_take isl_schedule *expansion); -__isl_give isl_band_list *isl_schedule_get_band_forest( - __isl_keep isl_schedule *schedule); - __isl_give isl_schedule *isl_schedule_read_from_file(isl_ctx *ctx, FILE *input); __isl_constructor __isl_give isl_schedule *isl_schedule_read_from_str(isl_ctx *ctx, @@ -195,9 +192,6 @@ __isl_give isl_printer *isl_printer_print_schedule(__isl_take isl_printer *p, void isl_schedule_dump(__isl_keep isl_schedule *schedule); __isl_give char *isl_schedule_to_str(__isl_keep isl_schedule *schedule); -int isl_schedule_foreach_band(__isl_keep isl_schedule *sched, - int (*fn)(__isl_keep isl_band *band, void *user), void *user); - #if defined(__cplusplus) } #endif diff --git a/polly/lib/External/isl/include/isl/schedule_node.h b/polly/lib/External/isl/include/isl/schedule_node.h index 51b31f9a4f0d..bfef140d9a04 100644 --- a/polly/lib/External/isl/include/isl/schedule_node.h +++ b/polly/lib/External/isl/include/isl/schedule_node.h @@ -37,6 +37,9 @@ isl_stat isl_schedule_node_foreach_descendant_top_down( __isl_keep isl_schedule_node *node, isl_bool (*fn)(__isl_keep isl_schedule_node *node, void *user), void *user); +isl_bool isl_schedule_node_every_descendant(__isl_keep isl_schedule_node *node, + isl_bool (*test)(__isl_keep isl_schedule_node *node, void *user), + void *user); isl_stat isl_schedule_node_foreach_ancestor_top_down( __isl_keep isl_schedule_node *node, isl_stat (*fn)(__isl_keep isl_schedule_node *node, void *user), diff --git a/polly/lib/External/isl/include/isl/set.h b/polly/lib/External/isl/include/isl/set.h index 76c00fa11ba4..16da1a7414d5 100644 --- a/polly/lib/External/isl/include/isl/set.h +++ b/polly/lib/External/isl/include/isl/set.h @@ -91,8 +91,8 @@ int isl_basic_set_is_rational(__isl_keep isl_basic_set *bset); __isl_null isl_basic_set *isl_basic_set_free(__isl_take isl_basic_set *bset); __isl_give isl_basic_set *isl_basic_set_copy(__isl_keep isl_basic_set *bset); -__isl_give isl_basic_set *isl_basic_set_empty(__isl_take isl_space *dim); -__isl_give isl_basic_set *isl_basic_set_universe(__isl_take isl_space *dim); +__isl_give isl_basic_set *isl_basic_set_empty(__isl_take isl_space *space); +__isl_give isl_basic_set *isl_basic_set_universe(__isl_take isl_space *space); __isl_give isl_basic_set *isl_basic_set_nat_universe(__isl_take isl_space *dim); __isl_give isl_basic_set *isl_basic_set_positive_orthant( __isl_take isl_space *space); @@ -236,8 +236,8 @@ isl_bool isl_basic_set_is_subset(__isl_keep isl_basic_set *bset1, isl_bool isl_basic_set_plain_is_equal(__isl_keep isl_basic_set *bset1, __isl_keep isl_basic_set *bset2); -__isl_give isl_set *isl_set_empty(__isl_take isl_space *dim); -__isl_give isl_set *isl_set_universe(__isl_take isl_space *dim); +__isl_give isl_set *isl_set_empty(__isl_take isl_space *space); +__isl_give isl_set *isl_set_universe(__isl_take isl_space *space); __isl_give isl_set *isl_set_nat_universe(__isl_take isl_space *dim); __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set); __isl_null isl_set *isl_set_free(__isl_take isl_set *set); @@ -312,9 +312,6 @@ __isl_give isl_set *isl_set_insert_dims(__isl_take isl_set *set, enum isl_dim_type type, unsigned pos, unsigned n); __isl_give isl_basic_set *isl_basic_set_add_dims(__isl_take isl_basic_set *bset, enum isl_dim_type type, unsigned n); -ISL_DEPRECATED -__isl_give isl_basic_set *isl_basic_set_add(__isl_take isl_basic_set *bset, - enum isl_dim_type type, unsigned n); __isl_give isl_set *isl_set_add_dims(__isl_take isl_set *set, enum isl_dim_type type, unsigned n); __isl_give isl_basic_set *isl_basic_set_move_dims(__isl_take isl_basic_set *bset, @@ -430,6 +427,17 @@ __isl_give isl_set *isl_set_gist_params(__isl_take isl_set *set, isl_stat isl_set_dim_residue_class_val(__isl_keep isl_set *set, int pos, __isl_give isl_val **modulo, __isl_give isl_val **residue); +struct isl_stride_info; +typedef struct isl_stride_info isl_stride_info; +__isl_give isl_val *isl_stride_info_get_stride(__isl_keep isl_stride_info *si); +__isl_give isl_aff *isl_stride_info_get_offset(__isl_keep isl_stride_info *si); +__isl_null isl_stride_info *isl_stride_info_free( + __isl_take isl_stride_info *si); +__isl_give isl_stride_info *isl_set_get_stride_info(__isl_keep isl_set *set, + int pos); +__isl_export +__isl_give isl_val *isl_set_get_stride(__isl_keep isl_set *set, int pos); + __isl_export __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set); diff --git a/polly/lib/External/isl/include/isl/space.h b/polly/lib/External/isl/include/isl/space.h index 78a18181384a..e7f959be325d 100644 --- a/polly/lib/External/isl/include/isl/space.h +++ b/polly/lib/External/isl/include/isl/space.h @@ -44,6 +44,9 @@ isl_bool isl_space_is_params(__isl_keep isl_space *space); isl_bool isl_space_is_set(__isl_keep isl_space *space); isl_bool isl_space_is_map(__isl_keep isl_space *space); +__isl_give isl_space *isl_space_add_param_id(__isl_take isl_space *space, + __isl_take isl_id *id); + __isl_give isl_space *isl_space_set_tuple_name(__isl_take isl_space *dim, enum isl_dim_type type, const char *s); isl_bool isl_space_has_tuple_name(__isl_keep isl_space *space, @@ -167,11 +170,11 @@ isl_bool isl_space_tuple_is_equal(__isl_keep isl_space *space1, ISL_DEPRECATED isl_bool isl_space_match(__isl_keep isl_space *space1, enum isl_dim_type type1, __isl_keep isl_space *space2, enum isl_dim_type type2); -ISL_DEPRECATED -int isl_space_tuple_match(__isl_keep isl_space *space1, enum isl_dim_type type1, - __isl_keep isl_space *space2, enum isl_dim_type type2); unsigned isl_space_dim(__isl_keep isl_space *dim, enum isl_dim_type type); +__isl_give isl_space *isl_space_flatten_domain(__isl_take isl_space *space); +__isl_give isl_space *isl_space_flatten_range(__isl_take isl_space *space); + __isl_give char *isl_space_to_str(__isl_keep isl_space *space); __isl_give isl_printer *isl_printer_print_space(__isl_take isl_printer *p, __isl_keep isl_space *dim); diff --git a/polly/lib/External/isl/include/isl/union_map.h b/polly/lib/External/isl/include/isl/union_map.h index a3efe6f47546..19d11b7aaa3c 100644 --- a/polly/lib/External/isl/include/isl/union_map.h +++ b/polly/lib/External/isl/include/isl/union_map.h @@ -24,7 +24,7 @@ __isl_give isl_union_map *isl_union_map_from_basic_map( __isl_take isl_basic_map *bmap); __isl_constructor __isl_give isl_union_map *isl_union_map_from_map(__isl_take isl_map *map); -__isl_give isl_union_map *isl_union_map_empty(__isl_take isl_space *dim); +__isl_give isl_union_map *isl_union_map_empty(__isl_take isl_space *space); __isl_give isl_union_map *isl_union_map_copy(__isl_keep isl_union_map *umap); __isl_null isl_union_map *isl_union_map_free(__isl_take isl_union_map *umap); @@ -55,8 +55,10 @@ __isl_give isl_union_map *isl_union_map_range_map( __isl_take isl_union_map *umap); __isl_give isl_union_map *isl_union_set_wrapped_domain_map( __isl_take isl_union_set *uset); +__isl_export __isl_give isl_union_map *isl_union_map_from_domain( __isl_take isl_union_set *uset); +__isl_export __isl_give isl_union_map *isl_union_map_from_range( __isl_take isl_union_set *uset); @@ -196,9 +198,13 @@ __isl_give isl_union_map *isl_union_set_identity(__isl_take isl_union_set *uset) __isl_give isl_union_map *isl_union_map_project_out( __isl_take isl_union_map *umap, enum isl_dim_type type, unsigned first, unsigned n); +__isl_export +__isl_give isl_union_map *isl_union_map_project_out_all_params( + __isl_take isl_union_map *umap); __isl_give isl_union_map *isl_union_map_remove_divs( __isl_take isl_union_map *bmap); +isl_bool isl_union_map_plain_is_empty(__isl_keep isl_union_map *umap); __isl_export isl_bool isl_union_map_is_empty(__isl_keep isl_union_map *umap); __isl_export @@ -228,6 +234,11 @@ int isl_union_map_n_map(__isl_keep isl_union_map *umap); __isl_export isl_stat isl_union_map_foreach_map(__isl_keep isl_union_map *umap, isl_stat (*fn)(__isl_take isl_map *map, void *user), void *user); +isl_bool isl_union_map_every_map(__isl_keep isl_union_map *umap, + isl_bool (*test)(__isl_keep isl_map *map, void *user), void *user); +__isl_give isl_union_map *isl_union_map_remove_map_if( + __isl_take isl_union_map *umap, + isl_bool (*fn)(__isl_keep isl_map *map, void *user), void *user); isl_bool isl_union_map_contains(__isl_keep isl_union_map *umap, __isl_keep isl_space *space); __isl_give isl_map *isl_union_map_extract_map(__isl_keep isl_union_map *umap, @@ -253,6 +264,7 @@ __isl_give isl_union_map *isl_union_map_lex_gt_union_map( __isl_give isl_union_map *isl_union_map_lex_ge_union_map( __isl_take isl_union_map *umap1, __isl_take isl_union_map *umap2); +__isl_overload __isl_give isl_union_map *isl_union_map_eq_at_multi_union_pw_aff( __isl_take isl_union_map *umap, __isl_take isl_multi_union_pw_aff *mupa); diff --git a/polly/lib/External/isl/include/isl/union_set.h b/polly/lib/External/isl/include/isl/union_set.h index ca4090b8c7b4..289693b8b7ce 100644 --- a/polly/lib/External/isl/include/isl/union_set.h +++ b/polly/lib/External/isl/include/isl/union_set.h @@ -16,7 +16,7 @@ __isl_give isl_union_set *isl_union_set_from_basic_set( __isl_take isl_basic_set *bset); __isl_constructor __isl_give isl_union_set *isl_union_set_from_set(__isl_take isl_set *set); -__isl_give isl_union_set *isl_union_set_empty(__isl_take isl_space *dim); +__isl_give isl_union_set *isl_union_set_empty(__isl_take isl_space *space); __isl_give isl_union_set *isl_union_set_copy(__isl_keep isl_union_set *uset); __isl_null isl_union_set *isl_union_set_free(__isl_take isl_union_set *uset); @@ -80,10 +80,13 @@ __isl_give isl_union_set *isl_union_set_gist_params( __isl_export __isl_give isl_union_set *isl_union_set_apply( __isl_take isl_union_set *uset, __isl_take isl_union_map *umap); +__isl_overload __isl_give isl_union_set *isl_union_set_preimage_multi_aff( __isl_take isl_union_set *uset, __isl_take isl_multi_aff *ma); +__isl_overload __isl_give isl_union_set *isl_union_set_preimage_pw_multi_aff( __isl_take isl_union_set *uset, __isl_take isl_pw_multi_aff *pma); +__isl_overload __isl_give isl_union_set *isl_union_set_preimage_union_pw_multi_aff( __isl_take isl_union_set *uset, __isl_take isl_union_pw_multi_aff *upma); diff --git a/polly/lib/External/isl/include/isl/vec.h b/polly/lib/External/isl/include/isl/vec.h index 6b587943e966..19b55792ebdf 100644 --- a/polly/lib/External/isl/include/isl/vec.h +++ b/polly/lib/External/isl/include/isl/vec.h @@ -24,6 +24,7 @@ struct isl_vec; typedef struct isl_vec isl_vec; __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx, unsigned size); +__isl_give isl_vec *isl_vec_zero(isl_ctx *ctx, unsigned size); __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec); __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec); diff --git a/polly/lib/External/isl/interface/isl.h.top b/polly/lib/External/isl/interface/isl.h.top deleted file mode 100644 index 37749c295969..000000000000 --- a/polly/lib/External/isl/interface/isl.h.top +++ /dev/null @@ -1,95 +0,0 @@ -/// These are automatically generated C++ bindings for isl. -/// -/// isl is a library for computing with integer sets and maps described by -/// Presburger formulas. On top of this, isl provides various tools for -/// polyhedral compilation, ranging from dependence analysis over scheduling -/// to AST generation. - -#ifndef ISL_CPP_NOEXCEPTIONS -#define ISL_CPP_NOEXCEPTIONS - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace isl { -inline namespace noexceptions { - -#define ISLPP_STRINGIZE_(X) #X -#define ISLPP_STRINGIZE(X) ISLPP_STRINGIZE_(X) - -#define ISLPP_ASSERT(test, message) \ - do { \ - if (test) \ - break; \ - fputs("Assertion \"" #test "\" failed at " __FILE__ \ - ":" ISLPP_STRINGIZE(__LINE__) "\n " message "\n", \ - stderr); \ - } while (0) - -class boolean { -private: - isl_bool val; - - friend isl::boolean manage(isl_bool val); - boolean(isl_bool val): val(val) {} -public: - boolean() - : val(isl_bool_error) {} - - /* implicit */ boolean(bool val) - : val(val ? isl_bool_true : isl_bool_false) {} - - bool is_error() const { return val == isl_bool_error; } - bool is_false() const { return val == isl_bool_false; } - bool is_true() const { return val == isl_bool_true; } - - explicit operator bool() const { - ISLPP_ASSERT(!is_error(), "IMPLEMENTATION ERROR: Unhandled error state"); - return is_true(); - } - - boolean operator!() const { - if (is_error()) - return *this; - return !is_true(); - } -}; - -inline isl::boolean manage(isl_bool val) { - return isl::boolean(val); -} - -class ctx { - isl_ctx *ptr; -public: - /* implicit */ ctx(isl_ctx *ctx) - : ptr(ctx) {} - isl_ctx *release() { - auto tmp = ptr; - ptr = nullptr; - return tmp; - } - isl_ctx *get() { - return ptr; - } -}; - -enum class stat { - ok = isl_stat_ok, - error = isl_stat_error -}; - -} -} // namespace isl diff --git a/polly/lib/External/isl/interface/isl_test_python.py b/polly/lib/External/isl/interface/isl_test_python.py new file mode 100755 index 000000000000..10b9c95e9a8b --- /dev/null +++ b/polly/lib/External/isl/interface/isl_test_python.py @@ -0,0 +1,201 @@ +# Copyright 2016-2017 Tobias Grosser +# +# Use of this software is governed by the MIT license +# +# Written by Tobias Grosser, Weststrasse 47, CH-8003, Zurich + +import sys +import isl + +# Test that isl objects can be constructed. +# +# This tests: +# - construction from a string +# - construction from an integer +# - static constructor without a parameter +# - conversion construction +# +# The tests to construct from integers and strings cover functionality that +# is also tested in the parameter type tests, but here the presence of +# multiple overloaded constructors and overload resolution is tested. +# +def test_constructors(): + zero1 = isl.val("0") + assert(zero1.is_zero()) + + zero2 = isl.val(0) + assert(zero2.is_zero()) + + zero3 = isl.val.zero() + assert(zero3.is_zero()) + + bs = isl.basic_set("{ [1] }") + result = isl.set("{ [1] }") + s = isl.set(bs) + assert(s.is_equal(result)) + +# Test integer function parameters for a particular integer value. +# +def test_int(i): + val_int = isl.val(i) + val_str = isl.val(str(i)) + assert(val_int.eq(val_str)) + +# Test integer function parameters. +# +# Verify that extreme values and zero work. +# +def test_parameters_int(): + test_int(sys.maxsize) + test_int(-sys.maxsize - 1) + test_int(0) + +# Test isl objects parameters. +# +# Verify that isl objects can be passed as lvalue and rvalue parameters. +# Also verify that isl object parameters are automatically type converted if +# there is an inheritance relation. Finally, test function calls without +# any additional parameters, apart from the isl object on which +# the method is called. +# +def test_parameters_obj(): + a = isl.set("{ [0] }") + b = isl.set("{ [1] }") + c = isl.set("{ [2] }") + expected = isl.set("{ [i] : 0 <= i <= 2 }") + + tmp = a.union(b) + res_lvalue_param = tmp.union(c) + assert(res_lvalue_param.is_equal(expected)) + + res_rvalue_param = a.union(b).union(c) + assert(res_rvalue_param.is_equal(expected)) + + a2 = isl.basic_set("{ [0] }") + assert(a.is_equal(a2)) + + two = isl.val(2) + half = isl.val("1/2") + res_only_this_param = two.inv() + assert(res_only_this_param.eq(half)) + +# Test different kinds of parameters to be passed to functions. +# +# This includes integer and isl object parameters. +# +def test_parameters(): + test_parameters_int() + test_parameters_obj() + +# Test that isl objects are returned correctly. +# +# This only tests that after combining two objects, the result is successfully +# returned. +# +def test_return_obj(): + one = isl.val("1") + two = isl.val("2") + three = isl.val("3") + + res = one.add(two) + + assert(res.eq(three)) + +# Test that integer values are returned correctly. +# +def test_return_int(): + one = isl.val("1") + neg_one = isl.val("-1") + zero = isl.val("0") + + assert(one.sgn() > 0) + assert(neg_one.sgn() < 0) + assert(zero.sgn() == 0) + +# Test that isl_bool values are returned correctly. +# +# In particular, check the conversion to bool in case of true and false. +# +def test_return_bool(): + empty = isl.set("{ : false }") + univ = isl.set("{ : }") + + b_true = empty.is_empty() + b_false = univ.is_empty() + + assert(b_true) + assert(not b_false) + +# Test that strings are returned correctly. +# Do so by calling overloaded isl.ast_build.from_expr methods. +# +def test_return_string(): + context = isl.set("[n] -> { : }") + build = isl.ast_build.from_context(context) + pw_aff = isl.pw_aff("[n] -> { [n] }") + set = isl.set("[n] -> { : n >= 0 }") + + expr = build.expr_from(pw_aff) + expected_string = "n" + assert(expected_string == expr.to_C_str()) + + expr = build.expr_from(set) + expected_string = "n >= 0" + assert(expected_string == expr.to_C_str()) + +# Test that return values are handled correctly. +# +# Test that isl objects, integers, boolean values, and strings are +# returned correctly. +# +def test_return(): + test_return_obj() + test_return_int() + test_return_bool() + test_return_string() + +# Test that foreach functions are modeled correctly. +# +# Verify that closures are correctly called as callback of a 'foreach' +# function and that variables captured by the closure work correctly. Also +# check that the foreach function handles exceptions thrown from +# the closure and that it propagates the exception. +# +def test_foreach(): + s = isl.set("{ [0]; [1]; [2] }") + + list = [] + def add(bs): + list.append(bs) + s.foreach_basic_set(add) + + assert(len(list) == 3) + assert(list[0].is_subset(s)) + assert(list[1].is_subset(s)) + assert(list[2].is_subset(s)) + assert(not list[0].is_equal(list[1])) + assert(not list[0].is_equal(list[2])) + assert(not list[1].is_equal(list[2])) + + def fail(bs): + raise "fail" + + caught = False + try: + s.foreach_basic_set(fail) + except: + caught = True + assert(caught) + +# Test the isl Python interface +# +# This includes: +# - Object construction +# - Different parameter types +# - Different return types +# - Foreach functions +# +test_constructors() +test_parameters() +test_return() +test_foreach() diff --git a/polly/lib/External/isl/isl.py b/polly/lib/External/isl/isl.py deleted file mode 100644 index 6382f6384e72..000000000000 --- a/polly/lib/External/isl/isl.py +++ /dev/null @@ -1,100 +0,0 @@ -import gdb -import re - -# GDB Pretty Printers for most isl objects -class IslObjectPrinter: - """Print an isl object""" - def __init__ (self, val, type): - self.val = val - self.type = type - - def to_string (self): - # Cast val to a void pointer to stop gdb using this pretty - # printer for the pointer which would lead to an infinite loop. - void_ptr = gdb.lookup_type('void').pointer() - value = str(self.val.cast(void_ptr)) - printer = gdb.parse_and_eval("isl_printer_to_str(isl_" - + str(self.type) - + "_get_ctx(" + value + "))") - printer = gdb.parse_and_eval("isl_printer_print_" - + str(self.type) + "(" - + str(printer) + ", " - + value + ")") - string = gdb.parse_and_eval("(char*)isl_printer_get_str(" - + str(printer) + ")") - gdb.parse_and_eval("isl_printer_free(" + str(printer) + ")") - return string - - def display_hint (self): - return 'string' - -class IslIntPrinter: - """Print an isl_int """ - def __init__ (self, val): - self.val = val - - def to_string (self): - # Cast val to a void pointer to stop gdb using this pretty - # printer for the pointer which would lead to an infinite loop. - void_ptr = gdb.lookup_type('void').pointer() - value = str(self.val.cast(void_ptr)) - - context = gdb.parse_and_eval("isl_ctx_alloc()") - printer = gdb.parse_and_eval("isl_printer_to_str(" - + str(context) + ")") - printer = gdb.parse_and_eval("isl_printer_print_isl_int(" - + str(printer) + ", " - + value + ")") - string = gdb.parse_and_eval("(char*)isl_printer_get_str(" - + str(printer) + ")") - gdb.parse_and_eval("isl_printer_free(" + str(printer) + ")") - gdb.parse_and_eval("isl_ctx_free(" + str(context) + ")") - return string - - def display_hint (self): - return 'string' - -class IslPrintCommand (gdb.Command): - """Print an isl value.""" - def __init__ (self): - super (IslPrintCommand, self).__init__ ("islprint", - gdb.COMMAND_OBSCURE) - def invoke (self, arg, from_tty): - arg = gdb.parse_and_eval(arg); - printer = str_lookup_function(arg) - - if printer == None: - print "No isl printer for this type" - return - - print printer.to_string() - -IslPrintCommand() - -def str_lookup_function (val): - if val.type.code != gdb.TYPE_CODE_PTR: - if str(val.type) == "isl_int": - return IslIntPrinter(val) - else: - return None - - lookup_tag = val.type.target() - regex = re.compile ("^isl_(.*)$") - - if lookup_tag == None: - return None - - m = regex.match (str(lookup_tag)) - - if m: - # Those types of printers defined in isl. - if m.group(1) in ["basic_set", "set", "union_set", "basic_map", - "map", "union_map", "qpolynomial", - "pw_qpolynomial", "pw_qpolynomial_fold", - "union_pw_qpolynomial", - "union_pw_qpolynomial_fold"]: - return IslObjectPrinter(val, m.group(1)) - return None - -# Do not register the pretty printer. -# gdb.current_objfile().pretty_printers.append(str_lookup_function) diff --git a/polly/lib/External/isl/isl_aff.c b/polly/lib/External/isl/isl_aff.c index 8b3f82bb785f..bec379642dfc 100644 --- a/polly/lib/External/isl/isl_aff.c +++ b/polly/lib/External/isl/isl_aff.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #undef BASE @@ -225,6 +224,30 @@ __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(__isl_take isl_local_space *ls, return isl_pw_aff_from_aff(isl_aff_var_on_domain(ls, type, pos)); } +/* Return an affine expression that is equal to the parameter + * in the domain space "space" with identifier "id". + */ +__isl_give isl_aff *isl_aff_param_on_domain_space_id( + __isl_take isl_space *space, __isl_take isl_id *id) +{ + int pos; + isl_local_space *ls; + + if (!space || !id) + goto error; + pos = isl_space_find_dim_by_id(space, isl_dim_param, id); + if (pos < 0) + isl_die(isl_space_get_ctx(space), isl_error_invalid, + "parameter not found in space", goto error); + isl_id_free(id); + ls = isl_local_space_from_space(space); + return isl_aff_var_on_domain(ls, isl_dim_param, pos); +error: + isl_space_free(space); + isl_id_free(id); + return NULL; +} + __isl_give isl_aff *isl_aff_copy(__isl_keep isl_aff *aff) { if (!aff) @@ -356,6 +379,59 @@ __isl_give isl_local_space *isl_aff_get_local_space(__isl_keep isl_aff *aff) return ls; } +/* Return the local space of the domain of "aff". + * This may be either a copy or the local space itself + * if there is only one reference to "aff". + * This allows the local space to be modified inplace + * if both the expression and its local space have only a single reference. + * The caller is not allowed to modify "aff" between this call and + * a subsequent call to isl_aff_restore_domain_local_space. + * The only exception is that isl_aff_free can be called instead. + */ +__isl_give isl_local_space *isl_aff_take_domain_local_space( + __isl_keep isl_aff *aff) +{ + isl_local_space *ls; + + if (!aff) + return NULL; + if (aff->ref != 1) + return isl_aff_get_domain_local_space(aff); + ls = aff->ls; + aff->ls = NULL; + return ls; +} + +/* Set the local space of the domain of "aff" to "ls", + * where the local space of "aff" may be missing + * due to a preceding call to isl_aff_take_domain_local_space. + * However, in this case, "aff" only has a single reference and + * then the call to isl_aff_cow has no effect. + */ +__isl_give isl_aff *isl_aff_restore_domain_local_space( + __isl_keep isl_aff *aff, __isl_take isl_local_space *ls) +{ + if (!aff || !ls) + goto error; + + if (aff->ls == ls) { + isl_local_space_free(ls); + return aff; + } + + aff = isl_aff_cow(aff); + if (!aff) + goto error; + isl_local_space_free(aff->ls); + aff->ls = ls; + + return aff; +error: + isl_aff_free(aff); + isl_local_space_free(ls); + return NULL; +} + /* Externally, an isl_aff has a map space, but internally, the * ls field corresponds to the domain of that space. */ @@ -565,21 +641,6 @@ __isl_give isl_val *isl_aff_get_denominator_val(__isl_keep isl_aff *aff) return isl_val_int_from_isl_int(ctx, aff->v->el[0]); } -/* Return the constant term of "aff" in "v". - * - * We cannot return anything meaningful in case of a NaN. - */ -int isl_aff_get_constant(__isl_keep isl_aff *aff, isl_int *v) -{ - if (!aff) - return -1; - if (isl_aff_is_nan(aff)) - isl_die(isl_aff_get_ctx(aff), isl_error_invalid, - "cannot get constant term of NaN", return -1); - isl_int_set(*v, aff->v->el[1]); - return 0; -} - /* Return the constant term of "aff". */ __isl_give isl_val *isl_aff_get_constant_val(__isl_keep isl_aff *aff) @@ -597,37 +658,6 @@ __isl_give isl_val *isl_aff_get_constant_val(__isl_keep isl_aff *aff) return isl_val_normalize(v); } -/* Return the coefficient of the variable of type "type" at position "pos" - * of "aff" in "v". - * - * We cannot return anything meaningful in case of a NaN. - */ -int isl_aff_get_coefficient(__isl_keep isl_aff *aff, - enum isl_dim_type type, int pos, isl_int *v) -{ - if (!aff) - return -1; - - if (type == isl_dim_out) - isl_die(aff->v->ctx, isl_error_invalid, - "output/set dimension does not have a coefficient", - return -1); - if (type == isl_dim_in) - type = isl_dim_set; - - if (pos >= isl_local_space_dim(aff->ls, type)) - isl_die(aff->v->ctx, isl_error_invalid, - "position out of bounds", return -1); - - if (isl_aff_is_nan(aff)) - isl_die(isl_aff_get_ctx(aff), isl_error_invalid, - "cannot get coefficient of NaN", return -1); - pos += isl_local_space_offset(aff->ls, type); - isl_int_set(*v, aff->v->el[1 + pos]); - - return 0; -} - /* Return the coefficient of the variable of type "type" at position "pos" * of "aff". */ @@ -686,29 +716,6 @@ int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff, enum isl_dim_type type, return isl_int_sgn(aff->v->el[1 + pos]); } -/* Replace the denominator of "aff" by "v". - * - * A NaN is unaffected by this operation. - */ -__isl_give isl_aff *isl_aff_set_denominator(__isl_take isl_aff *aff, isl_int v) -{ - if (!aff) - return NULL; - if (isl_aff_is_nan(aff)) - return aff; - aff = isl_aff_cow(aff); - if (!aff) - return NULL; - - aff->v = isl_vec_cow(aff->v); - if (!aff->v) - return isl_aff_free(aff); - - isl_int_set(aff->v->el[0], v); - - return aff; -} - /* Replace the numerator of the constant term of "aff" by "v". * * A NaN is unaffected by this operation. @@ -1548,23 +1555,6 @@ __isl_give isl_aff *isl_aff_floor(__isl_take isl_aff *aff) return aff; } -/* Compute - * - * aff mod m = aff - m * floor(aff/m) - */ -__isl_give isl_aff *isl_aff_mod(__isl_take isl_aff *aff, isl_int m) -{ - isl_aff *res; - - res = isl_aff_copy(aff); - aff = isl_aff_scale_down(aff, m); - aff = isl_aff_floor(aff); - aff = isl_aff_scale(aff, m); - res = isl_aff_sub(res, aff); - - return res; -} - /* Compute * * aff mod m = aff - m * floor(aff/m) @@ -2488,6 +2478,20 @@ __isl_give isl_aff *isl_aff_project_domain_on_params(__isl_take isl_aff *aff) return aff; } +/* Convert an affine expression defined over a parameter domain + * into one that is defined over a zero-dimensional set. + */ +__isl_give isl_aff *isl_aff_from_range(__isl_take isl_aff *aff) +{ + isl_local_space *ls; + + ls = isl_aff_take_domain_local_space(aff); + ls = isl_local_space_set_from_params(ls); + aff = isl_aff_restore_domain_local_space(aff, ls); + + return aff; +} + __isl_give isl_aff *isl_aff_insert_dims(__isl_take isl_aff *aff, enum isl_dim_type type, unsigned first, unsigned n) { @@ -3829,6 +3833,7 @@ error: #include #include #include +#include #include #include @@ -6272,6 +6277,7 @@ error: #include #include #include +#include #include #include #include @@ -7540,7 +7546,7 @@ static isl_stat reset_params(__isl_take isl_pw_aff *pa, void *user) isl_space *space; space = isl_pw_aff_get_space(pa); - space = isl_space_replace(space, isl_dim_param, data->space); + space = isl_space_replace_params(space, data->space); pa = isl_pw_aff_reset_space(pa, space); data->res = isl_union_pw_aff_add_pw_aff(data->res, pa); @@ -7626,36 +7632,6 @@ error: return NULL; } -/* Internal data structure for isl_union_pw_aff_aff_on_domain. - * "aff" is the symbolic value that the resulting isl_union_pw_aff - * needs to attain. - * "res" collects the results. - */ -struct isl_union_pw_aff_aff_on_domain_data { - isl_aff *aff; - isl_union_pw_aff *res; -}; - -/* Construct a piecewise affine expression that is equal to data->aff - * on "domain" and add the result to data->res. - */ -static isl_stat pw_aff_aff_on_domain(__isl_take isl_set *domain, void *user) -{ - struct isl_union_pw_aff_aff_on_domain_data *data = user; - isl_pw_aff *pa; - isl_aff *aff; - int dim; - - aff = isl_aff_copy(data->aff); - dim = isl_set_dim(domain, isl_dim_set); - aff = isl_aff_add_dims(aff, isl_dim_in, dim); - aff = isl_aff_reset_domain_space(aff, isl_set_get_space(domain)); - pa = isl_pw_aff_alloc(domain, aff); - data->res = isl_union_pw_aff_add_pw_aff(data->res, pa); - - return data->res ? isl_stat_ok : isl_stat_error; -} - /* Internal data structure for isl_union_pw_multi_aff_get_union_pw_aff. * pos is the output position that needs to be extracted. * res collects the results. @@ -7719,33 +7695,129 @@ __isl_give isl_union_pw_aff *isl_union_pw_multi_aff_get_union_pw_aff( /* Return a union piecewise affine expression * that is equal to "aff" on "domain". - * - * Construct an isl_pw_aff on each of the sets in "domain" and - * collect the results. */ __isl_give isl_union_pw_aff *isl_union_pw_aff_aff_on_domain( __isl_take isl_union_set *domain, __isl_take isl_aff *aff) { - struct isl_union_pw_aff_aff_on_domain_data data; - isl_space *space; + isl_pw_aff *pa; - if (!domain || !aff) - goto error; - if (!isl_local_space_is_params(aff->ls)) - isl_die(isl_aff_get_ctx(aff), isl_error_invalid, - "expecting parametric expression", goto error); + pa = isl_pw_aff_from_aff(aff); + return isl_union_pw_aff_pw_aff_on_domain(domain, pa); +} + +/* Return a union piecewise affine expression + * that is equal to the parameter identified by "id" on "domain". + * + * Make sure the parameter appears in the space passed to + * isl_aff_param_on_domain_space_id. + */ +__isl_give isl_union_pw_aff *isl_union_pw_aff_param_on_domain_id( + __isl_take isl_union_set *domain, __isl_take isl_id *id) +{ + isl_space *space; + isl_aff *aff; + + space = isl_union_set_get_space(domain); + space = isl_space_add_param_id(space, isl_id_copy(id)); + aff = isl_aff_param_on_domain_space_id(space, id); + return isl_union_pw_aff_aff_on_domain(domain, aff); +} + +/* Internal data structure for isl_union_pw_aff_pw_aff_on_domain. + * "pa" is the piecewise symbolic value that the resulting isl_union_pw_aff + * needs to attain. + * "res" collects the results. + */ +struct isl_union_pw_aff_pw_aff_on_domain_data { + isl_pw_aff *pa; + isl_union_pw_aff *res; +}; + +/* Construct a piecewise affine expression that is equal to data->pa + * on "domain" and add the result to data->res. + */ +static isl_stat pw_aff_on_domain(__isl_take isl_set *domain, void *user) +{ + struct isl_union_pw_aff_pw_aff_on_domain_data *data = user; + isl_pw_aff *pa; + int dim; + + pa = isl_pw_aff_copy(data->pa); + dim = isl_set_dim(domain, isl_dim_set); + pa = isl_pw_aff_from_range(pa); + pa = isl_pw_aff_add_dims(pa, isl_dim_in, dim); + pa = isl_pw_aff_reset_domain_space(pa, isl_set_get_space(domain)); + pa = isl_pw_aff_intersect_domain(pa, domain); + data->res = isl_union_pw_aff_add_pw_aff(data->res, pa); + + return data->res ? isl_stat_ok : isl_stat_error; +} + +/* Return a union piecewise affine expression + * that is equal to "pa" on "domain", assuming "domain" and "pa" + * have been aligned. + * + * Construct an isl_pw_aff on each of the sets in "domain" and + * collect the results. + */ +static __isl_give isl_union_pw_aff *isl_union_pw_aff_pw_aff_on_domain_aligned( + __isl_take isl_union_set *domain, __isl_take isl_pw_aff *pa) +{ + struct isl_union_pw_aff_pw_aff_on_domain_data data; + isl_space *space; space = isl_union_set_get_space(domain); data.res = isl_union_pw_aff_empty(space); - data.aff = aff; - if (isl_union_set_foreach_set(domain, &pw_aff_aff_on_domain, &data) < 0) + data.pa = pa; + if (isl_union_set_foreach_set(domain, &pw_aff_on_domain, &data) < 0) data.res = isl_union_pw_aff_free(data.res); isl_union_set_free(domain); - isl_aff_free(aff); + isl_pw_aff_free(pa); return data.res; +} + +/* Return a union piecewise affine expression + * that is equal to "pa" on "domain". + * + * Check that "pa" is a parametric expression, + * align the parameters if needed and call + * isl_union_pw_aff_pw_aff_on_domain_aligned. + */ +__isl_give isl_union_pw_aff *isl_union_pw_aff_pw_aff_on_domain( + __isl_take isl_union_set *domain, __isl_take isl_pw_aff *pa) +{ + isl_bool is_set; + isl_bool equal_params; + isl_space *domain_space, *pa_space; + + pa_space = isl_pw_aff_peek_space(pa); + is_set = isl_space_is_set(pa_space); + if (is_set < 0) + goto error; + if (!is_set) + isl_die(isl_pw_aff_get_ctx(pa), isl_error_invalid, + "expecting parametric expression", goto error); + + domain_space = isl_union_set_get_space(domain); + pa_space = isl_pw_aff_get_space(pa); + equal_params = isl_space_has_equal_params(domain_space, pa_space); + if (equal_params >= 0 && !equal_params) { + isl_space *space; + + space = isl_space_align_params(domain_space, pa_space); + pa = isl_pw_aff_align_params(pa, isl_space_copy(space)); + domain = isl_union_set_align_params(domain, space); + } else { + isl_space_free(domain_space); + isl_space_free(pa_space); + } + + if (equal_params < 0) + goto error; + return isl_union_pw_aff_pw_aff_on_domain_aligned(domain, pa); error: isl_union_set_free(domain); - isl_aff_free(aff); + isl_pw_aff_free(pa); return NULL; } @@ -7993,7 +8065,6 @@ error: #define DOMBASE union_set #define NO_MOVE_DIMS -#define NO_DIMS #define NO_DOMAIN #define NO_PRODUCT #define NO_SPLICE @@ -8014,14 +8085,22 @@ error: * * Since there is no canonical zero value for * a union piecewise affine expression, we can only construct - * zero-dimensional "zero" value. + * a zero-dimensional "zero" value. */ __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_zero( __isl_take isl_space *space) { + isl_bool params; + if (!space) return NULL; + params = isl_space_is_params(space); + if (params < 0) + goto error; + if (params) + isl_die(isl_space_get_ctx(space), isl_error_invalid, + "expecting proper set space", goto error); if (!isl_space_is_set(space)) isl_die(isl_space_get_ctx(space), isl_error_invalid, "expecting set space", goto error); @@ -8261,66 +8340,81 @@ error: return NULL; } -/* Return a multiple union piecewise affine expression - * that is equal to "ma" on "domain", assuming "domain" and "ma" - * have been aligned. - */ -static __isl_give isl_multi_union_pw_aff * -isl_multi_union_pw_aff_multi_aff_on_domain_aligned( - __isl_take isl_union_set *domain, __isl_take isl_multi_aff *ma) -{ - int i, n; - isl_space *space; - isl_multi_union_pw_aff *mupa; - - if (!domain || !ma) - goto error; - - n = isl_multi_aff_dim(ma, isl_dim_set); - space = isl_multi_aff_get_space(ma); - mupa = isl_multi_union_pw_aff_alloc(space); - for (i = 0; i < n; ++i) { - isl_aff *aff; - isl_union_pw_aff *upa; - - aff = isl_multi_aff_get_aff(ma, i); - upa = isl_union_pw_aff_aff_on_domain(isl_union_set_copy(domain), - aff); - mupa = isl_multi_union_pw_aff_set_union_pw_aff(mupa, i, upa); - } - - isl_union_set_free(domain); - isl_multi_aff_free(ma); - return mupa; -error: - isl_union_set_free(domain); - isl_multi_aff_free(ma); - return NULL; -} - /* Return a multiple union piecewise affine expression * that is equal to "ma" on "domain". */ __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_multi_aff_on_domain( __isl_take isl_union_set *domain, __isl_take isl_multi_aff *ma) { - isl_bool equal_params; + isl_pw_multi_aff *pma; - if (!domain || !ma) + pma = isl_pw_multi_aff_from_multi_aff(ma); + return isl_multi_union_pw_aff_pw_multi_aff_on_domain(domain, pma); +} + +/* Return a multiple union piecewise affine expression + * that is equal to "pma" on "domain", assuming "domain" and "pma" + * have been aligned. + */ +static __isl_give isl_multi_union_pw_aff * +isl_multi_union_pw_aff_pw_multi_aff_on_domain_aligned( + __isl_take isl_union_set *domain, __isl_take isl_pw_multi_aff *pma) +{ + int i, n; + isl_space *space; + isl_multi_union_pw_aff *mupa; + + if (!domain || !pma) goto error; - equal_params = isl_space_has_equal_params(domain->dim, ma->space); + + n = isl_pw_multi_aff_dim(pma, isl_dim_set); + space = isl_pw_multi_aff_get_space(pma); + mupa = isl_multi_union_pw_aff_alloc(space); + for (i = 0; i < n; ++i) { + isl_pw_aff *pa; + isl_union_pw_aff *upa; + + pa = isl_pw_multi_aff_get_pw_aff(pma, i); + upa = isl_union_pw_aff_pw_aff_on_domain( + isl_union_set_copy(domain), pa); + mupa = isl_multi_union_pw_aff_set_union_pw_aff(mupa, i, upa); + } + + isl_union_set_free(domain); + isl_pw_multi_aff_free(pma); + return mupa; +error: + isl_union_set_free(domain); + isl_pw_multi_aff_free(pma); + return NULL; +} + +/* Return a multiple union piecewise affine expression + * that is equal to "pma" on "domain". + */ +__isl_give isl_multi_union_pw_aff * +isl_multi_union_pw_aff_pw_multi_aff_on_domain(__isl_take isl_union_set *domain, + __isl_take isl_pw_multi_aff *pma) +{ + isl_bool equal_params; + isl_space *space; + + space = isl_pw_multi_aff_peek_space(pma); + equal_params = isl_union_set_space_has_equal_params(domain, space); if (equal_params < 0) goto error; if (equal_params) - return isl_multi_union_pw_aff_multi_aff_on_domain_aligned( - domain, ma); + return isl_multi_union_pw_aff_pw_multi_aff_on_domain_aligned( + domain, pma); domain = isl_union_set_align_params(domain, - isl_multi_aff_get_space(ma)); - ma = isl_multi_aff_align_params(ma, isl_union_set_get_space(domain)); - return isl_multi_union_pw_aff_multi_aff_on_domain_aligned(domain, ma); + isl_pw_multi_aff_get_space(pma)); + pma = isl_pw_multi_aff_align_params(pma, + isl_union_set_get_space(domain)); + return isl_multi_union_pw_aff_pw_multi_aff_on_domain_aligned(domain, + pma); error: isl_union_set_free(domain); - isl_multi_aff_free(ma); + isl_pw_multi_aff_free(pma); return NULL; } diff --git a/polly/lib/External/isl/isl_aff_private.h b/polly/lib/External/isl/isl_aff_private.h index d503c41d0166..8ee5b00e04c3 100644 --- a/polly/lib/External/isl/isl_aff_private.h +++ b/polly/lib/External/isl/isl_aff_private.h @@ -73,7 +73,6 @@ __isl_give isl_aff *isl_aff_reset_domain_space(__isl_take isl_aff *aff, __isl_give isl_aff *isl_aff_realign_domain(__isl_take isl_aff *aff, __isl_take isl_reordering *r); -int isl_aff_get_constant(__isl_keep isl_aff *aff, isl_int *v); __isl_give isl_aff *isl_aff_set_constant(__isl_take isl_aff *aff, isl_int v); __isl_give isl_aff *isl_aff_set_coefficient(__isl_take isl_aff *aff, enum isl_dim_type type, int pos, isl_int v); @@ -102,6 +101,7 @@ __isl_give isl_pw_aff *isl_pw_aff_set_rational(__isl_take isl_pw_aff *pwaff); __isl_give isl_pw_aff_list *isl_pw_aff_list_set_rational( __isl_take isl_pw_aff_list *list); +__isl_give isl_aff *isl_aff_scale_down(__isl_take isl_aff *aff, isl_int f); __isl_give isl_pw_aff *isl_pw_aff_scale(__isl_take isl_pw_aff *pwaff, isl_int f); __isl_give isl_pw_aff *isl_pw_aff_scale_down(__isl_take isl_pw_aff *pwaff, diff --git a/polly/lib/External/isl/isl_ast.c b/polly/lib/External/isl/isl_ast.c index f13f8a6bcb33..91d0e99b40a6 100644 --- a/polly/lib/External/isl/isl_ast.c +++ b/polly/lib/External/isl/isl_ast.c @@ -9,6 +9,7 @@ #include +#include #include #undef BASE diff --git a/polly/lib/External/isl/isl_ast_build.c b/polly/lib/External/isl/isl_ast_build.c index 65ab6d51c3f2..c7be0a97b652 100644 --- a/polly/lib/External/isl/isl_ast_build.c +++ b/polly/lib/External/isl/isl_ast_build.c @@ -10,6 +10,8 @@ * B.P. 105 - 78153 Le Chesnay, France */ +#include +#include #include #include #include @@ -93,7 +95,7 @@ static __isl_give isl_id *generate_name(isl_ctx *ctx, int i, __isl_keep isl_ast_build *build) { int j; - char name[16]; + char name[23]; isl_set *dom = build->domain; snprintf(name, sizeof(name), "c%d", i); @@ -1180,9 +1182,14 @@ __isl_give isl_space *isl_ast_build_get_space(__isl_keep isl_ast_build *build, dim = isl_set_dim(build->domain, isl_dim_set); space = isl_space_drop_dims(space, isl_dim_set, build->depth, dim - build->depth); - for (i = build->depth - 1; i >= 0; --i) - if (isl_ast_build_has_affine_value(build, i)) + for (i = build->depth - 1; i >= 0; --i) { + isl_bool affine = isl_ast_build_has_affine_value(build, i); + + if (affine < 0) + return isl_space_free(space); + if (affine) space = isl_space_drop_dims(space, isl_dim_set, i, 1); + } return space; } @@ -1254,30 +1261,6 @@ __isl_give isl_id *isl_ast_build_get_iterator_id( /* Set the stride and offset of the current dimension to the given * value and expression. - * - * If we had already found a stride before, then the two strides - * are combined into a single stride. - * - * In particular, if the new stride information is of the form - * - * i = f + s (...) - * - * and the old stride information is of the form - * - * i = f2 + s2 (...) - * - * then we compute the extended gcd of s and s2 - * - * a s + b s2 = g, - * - * with g = gcd(s,s2), multiply the first equation with t1 = b s2/g - * and the second with t2 = a s1/g. - * This results in - * - * i = (b s2 + a s1)/g i = t1 f + t2 f2 + (s s2)/g (...) - * - * so that t1 f + t2 f2 is the combined offset and (s s2)/g = lcm(s,s2) - * is the combined stride. */ static __isl_give isl_ast_build *set_stride(__isl_take isl_ast_build *build, __isl_take isl_val *stride, __isl_take isl_aff *offset) @@ -1290,25 +1273,6 @@ static __isl_give isl_ast_build *set_stride(__isl_take isl_ast_build *build, pos = build->depth; - if (isl_ast_build_has_stride(build, pos)) { - isl_val *stride2, *a, *b, *g; - isl_aff *offset2; - - stride2 = isl_vec_get_element_val(build->strides, pos); - g = isl_val_gcdext(isl_val_copy(stride), isl_val_copy(stride2), - &a, &b); - a = isl_val_mul(a, isl_val_copy(stride)); - a = isl_val_div(a, isl_val_copy(g)); - stride2 = isl_val_div(stride2, g); - b = isl_val_mul(b, isl_val_copy(stride2)); - stride = isl_val_mul(stride, stride2); - - offset2 = isl_multi_aff_get_aff(build->offsets, pos); - offset2 = isl_aff_scale_val(offset2, a); - offset = isl_aff_scale_val(offset, b); - offset = isl_aff_add(offset, offset2); - } - build->strides = isl_vec_set_element_val(build->strides, pos, stride); build->offsets = isl_multi_aff_set_aff(build->offsets, pos, offset); if (!build->strides || !build->offsets) @@ -1424,134 +1388,44 @@ __isl_give isl_ast_build *isl_ast_build_include_stride( return build; } -/* Information used inside detect_stride. - * - * "build" may be updated by detect_stride to include stride information. - * "pos" is equal to build->depth. - */ -struct isl_detect_stride_data { - isl_ast_build *build; - int pos; -}; - -/* Check if constraint "c" imposes any stride on dimension data->pos - * and, if so, update the stride information in data->build. - * - * In order to impose a stride on the dimension, "c" needs to be an equality - * and it needs to involve the dimension. Note that "c" may also be - * a div constraint and thus an inequality that we cannot use. - * - * Let c be of the form - * - * h(p) + g * v * i + g * stride * f(alpha) = 0 - * - * with h(p) an expression in terms of the parameters and outer dimensions - * and f(alpha) an expression in terms of the existentially quantified - * variables. Note that the inner dimensions have been eliminated so - * they do not appear in "c". - * - * If "stride" is not zero and not one, then it represents a non-trivial stride - * on "i". We compute a and b such that - * - * a v + b stride = 1 - * - * We have - * - * g v i = -h(p) + g stride f(alpha) - * - * a g v i = -a h(p) + g stride f(alpha) - * - * a g v i + b g stride i = -a h(p) + g stride * (...) - * - * g i = -a h(p) + g stride * (...) - * - * i = -a h(p)/g + stride * (...) - * - * The expression "-a h(p)/g" can therefore be used as offset. - */ -static isl_stat detect_stride(__isl_take isl_constraint *c, void *user) -{ - struct isl_detect_stride_data *data = user; - int i, n_div; - isl_ctx *ctx; - isl_val *v, *stride, *m; - - if (!isl_constraint_is_equality(c) || - !isl_constraint_involves_dims(c, isl_dim_set, data->pos, 1)) { - isl_constraint_free(c); - return isl_stat_ok; - } - - ctx = isl_constraint_get_ctx(c); - stride = isl_val_zero(ctx); - n_div = isl_constraint_dim(c, isl_dim_div); - for (i = 0; i < n_div; ++i) { - v = isl_constraint_get_coefficient_val(c, isl_dim_div, i); - stride = isl_val_gcd(stride, v); - } - - v = isl_constraint_get_coefficient_val(c, isl_dim_set, data->pos); - m = isl_val_gcd(isl_val_copy(stride), isl_val_copy(v)); - stride = isl_val_div(stride, isl_val_copy(m)); - v = isl_val_div(v, isl_val_copy(m)); - - if (!isl_val_is_zero(stride) && !isl_val_is_one(stride)) { - isl_aff *aff; - isl_val *gcd, *a, *b; - - gcd = isl_val_gcdext(v, isl_val_copy(stride), &a, &b); - isl_val_free(gcd); - isl_val_free(b); - - aff = isl_constraint_get_aff(c); - for (i = 0; i < n_div; ++i) - aff = isl_aff_set_coefficient_si(aff, - isl_dim_div, i, 0); - aff = isl_aff_set_coefficient_si(aff, isl_dim_in, data->pos, 0); - a = isl_val_neg(a); - aff = isl_aff_scale_val(aff, a); - aff = isl_aff_scale_down_val(aff, m); - data->build = set_stride(data->build, stride, aff); - } else { - isl_val_free(stride); - isl_val_free(m); - isl_val_free(v); - } - - isl_constraint_free(c); - return isl_stat_ok; -} - /* Check if the constraints in "set" imply any stride on the current * dimension and, if so, record the stride information in "build" * and return the updated "build". * - * We compute the affine hull and then check if any of the constraints - * in the hull imposes any stride on the current dimension. - * * We assume that inner dimensions have been eliminated from "set" * by the caller. This is needed because the common stride * may be imposed by different inner dimensions on different parts of * the domain. + * The assumption ensures that the lower bound does not depend + * on inner dimensions. */ __isl_give isl_ast_build *isl_ast_build_detect_strides( __isl_take isl_ast_build *build, __isl_take isl_set *set) { - isl_basic_set *hull; - struct isl_detect_stride_data data; + int pos; + isl_bool no_stride; + isl_val *stride; + isl_aff *offset; + isl_stride_info *si; if (!build) goto error; - data.build = build; - data.pos = isl_ast_build_get_depth(build); - hull = isl_set_affine_hull(set); + pos = isl_ast_build_get_depth(build); + si = isl_set_get_stride_info(set, pos); + stride = isl_stride_info_get_stride(si); + offset = isl_stride_info_get_offset(si); + isl_stride_info_free(si); + isl_set_free(set); - if (isl_basic_set_foreach_constraint(hull, &detect_stride, &data) < 0) - data.build = isl_ast_build_free(data.build); - - isl_basic_set_free(hull); - return data.build; + no_stride = isl_val_is_one(stride); + if (no_stride >= 0 && !no_stride) + return set_stride(build, stride, offset); + isl_val_free(stride); + isl_aff_free(offset); + if (no_stride < 0) + return isl_ast_build_free(build); + return build; error: isl_set_free(set); return NULL; @@ -2088,23 +1962,20 @@ __isl_give isl_aff *isl_ast_build_get_offset( * Otherwise, it is set to the requested expression in terms of * outer dimensions and parameters. */ -int isl_ast_build_has_affine_value(__isl_keep isl_ast_build *build, +isl_bool isl_ast_build_has_affine_value(__isl_keep isl_ast_build *build, int pos) { isl_aff *aff; - int involves; + isl_bool involves; if (!build) - return -1; + return isl_bool_error; aff = isl_multi_aff_get_aff(build->values, pos); involves = isl_aff_involves_dims(aff, isl_dim_in, pos, 1); isl_aff_free(aff); - if (involves < 0) - return -1; - - return !involves; + return isl_bool_not(involves); } /* Plug in the known values (fixed affine expressions in terms of diff --git a/polly/lib/External/isl/isl_ast_build_expr.c b/polly/lib/External/isl/isl_ast_build_expr.c index 3213886ddf29..76cd57f021ac 100644 --- a/polly/lib/External/isl/isl_ast_build_expr.c +++ b/polly/lib/External/isl/isl_ast_build_expr.c @@ -10,8 +10,10 @@ * B.P. 105 - 78153 Le Chesnay, France */ +#include #include #include +#include #include #include #include diff --git a/polly/lib/External/isl/isl_ast_build_private.h b/polly/lib/External/isl/isl_ast_build_private.h index ae638c7157b8..77d4ffd06cd7 100644 --- a/polly/lib/External/isl/isl_ast_build_private.h +++ b/polly/lib/External/isl/isl_ast_build_private.h @@ -250,7 +250,8 @@ __isl_give isl_multi_aff *isl_ast_build_get_schedule_map_multi_aff( __isl_keep isl_ast_build *build); __isl_give isl_map *isl_ast_build_get_schedule_map( __isl_keep isl_ast_build *build); -int isl_ast_build_has_affine_value(__isl_keep isl_ast_build *build, int pos); +isl_bool isl_ast_build_has_affine_value(__isl_keep isl_ast_build *build, + int pos); int isl_ast_build_has_value(__isl_keep isl_ast_build *build); __isl_give isl_id *isl_ast_build_get_iterator_id( __isl_keep isl_ast_build *build, int pos); diff --git a/polly/lib/External/isl/isl_ast_codegen.c b/polly/lib/External/isl/isl_ast_codegen.c index c56d4d5cf073..8f2e9c7c313f 100644 --- a/polly/lib/External/isl/isl_ast_codegen.c +++ b/polly/lib/External/isl/isl_ast_codegen.c @@ -11,6 +11,8 @@ */ #include +#include +#include #include #include #include @@ -1453,7 +1455,8 @@ static __isl_give isl_ast_graft *create_node_scaled( __isl_take isl_ast_build *build) { int depth; - int degenerate, eliminated; + int degenerate; + isl_bool eliminated; isl_basic_set *hull; isl_basic_set *enforced; isl_set *guard, *hoisted; @@ -3521,6 +3524,12 @@ static __isl_give isl_ast_graft_list *generate_shifted_component_only_after( * to the isolated domain). * We generate an AST for each piece and concatenate the results. * + * If the isolated domain is not convex, then it is replaced + * by a convex superset to ensure that the sets of preceding and + * following iterations are properly defined and, in particular, + * that there are no intermediate iterations that do not belong + * to the isolated domain. + * * In the special case where at least one element of the schedule * domain that does not belong to the isolated domain needs * to be scheduled after this isolated domain, but none of those @@ -5171,7 +5180,7 @@ static __isl_give isl_ast_graft_list *hoist_out_of_context( * to the domain elements executed by those iterations. * * The context node may introduce additional parameters as well as - * constraints on the outer schedule dimenions or original parameters. + * constraints on the outer schedule dimensions or original parameters. * * We add the extra parameters to a new build and the context * constraints to both the build and (as a single disjunct) @@ -5735,6 +5744,8 @@ __isl_give isl_ast_node *isl_ast_build_node_from_schedule( ctx = isl_ast_build_get_ctx(build); node = isl_schedule_get_root(schedule); + if (!node) + goto error; isl_schedule_free(schedule); build = isl_ast_build_copy(build); diff --git a/polly/lib/External/isl/isl_ast_graft.c b/polly/lib/External/isl/isl_ast_graft.c index 6d90dd2b49ee..de061c7871c7 100644 --- a/polly/lib/External/isl/isl_ast_graft.c +++ b/polly/lib/External/isl/isl_ast_graft.c @@ -10,6 +10,7 @@ * B.P. 105 - 78153 Le Chesnay, France */ +#include #include #include #include @@ -1230,6 +1231,7 @@ __isl_give isl_ast_graft_list *isl_ast_graft_list_merge( disjoint = isl_set_is_disjoint(graft->guard, list1->p[j - 1]->guard); if (disjoint < 0) { + isl_ast_graft_free(graft); list1 = isl_ast_graft_list_free(list1); break; } @@ -1253,10 +1255,12 @@ __isl_give isl_ast_graft_list *isl_ast_graft_list_merge( break; } - if (j < 0) + if (j < 0) { + isl_ast_graft_free(graft); isl_die(isl_ast_build_get_ctx(build), isl_error_internal, "element failed to get inserted", break); + } first = j + 1; if (!list1) diff --git a/polly/lib/External/isl/isl_ast_int.c b/polly/lib/External/isl/isl_ast_int.c deleted file mode 100644 index 178c38cf32a2..000000000000 --- a/polly/lib/External/isl/isl_ast_int.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include -#include - -int isl_ast_expr_get_int(__isl_keep isl_ast_expr *expr, isl_int *v) -{ - if (!expr) - return -1; - if (expr->type != isl_ast_expr_int) - isl_die(isl_ast_expr_get_ctx(expr), isl_error_invalid, - "expression not an int", return -1); - return isl_val_get_num_isl_int(expr->u.v, v); -} diff --git a/polly/lib/External/isl/isl_band.c b/polly/lib/External/isl/isl_band.c deleted file mode 100644 index 43569d65e893..000000000000 --- a/polly/lib/External/isl/isl_band.c +++ /dev/null @@ -1,727 +0,0 @@ -/* - * Copyright 2011 INRIA Saclay - * Copyright 2012-2013 Ecole Normale Superieure - * - * Use of this software is governed by the MIT license - * - * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France, - * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod, - * 91893 Orsay, France - * and Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France - */ - -#include -#include - -#undef BASE -#define BASE band - -#include - -isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band) -{ - return band ? isl_union_pw_multi_aff_get_ctx(band->pma) : NULL; -} - -__isl_give isl_band *isl_band_alloc(isl_ctx *ctx) -{ - isl_band *band; - - band = isl_calloc_type(ctx, isl_band); - if (!band) - return NULL; - - band->ref = 1; - - return band; -} - -/* Create a duplicate of the given band. The duplicate refers - * to the same schedule and parent as the input, but does not - * increment their reference counts. - */ -__isl_give isl_band *isl_band_dup(__isl_keep isl_band *band) -{ - int i; - isl_ctx *ctx; - isl_band *dup; - - if (!band) - return NULL; - - ctx = isl_band_get_ctx(band); - dup = isl_band_alloc(ctx); - if (!dup) - return NULL; - - dup->n = band->n; - dup->coincident = isl_alloc_array(ctx, int, band->n); - if (band->n && !dup->coincident) - goto error; - - for (i = 0; i < band->n; ++i) - dup->coincident[i] = band->coincident[i]; - - dup->pma = isl_union_pw_multi_aff_copy(band->pma); - dup->schedule = band->schedule; - dup->parent = band->parent; - - if (!dup->pma) - goto error; - - return dup; -error: - isl_band_free(dup); - return NULL; -} - -/* We not only increment the reference count of the band, - * but also that of the schedule that contains this band. - * This ensures that the schedule won't disappear while there - * is still a reference to the band outside of the schedule. - * There is no need to increment the reference count of the parent - * band as the parent band is part of the same schedule. - */ -__isl_give isl_band *isl_band_copy(__isl_keep isl_band *band) -{ - if (!band) - return NULL; - - band->ref++; - band->schedule->ref++; - return band; -} - -/* If this is not the last reference to the band (the one from within the - * schedule), then we also need to decrement the reference count of the - * containing schedule as it was incremented in isl_band_copy. - */ -__isl_null isl_band *isl_band_free(__isl_take isl_band *band) -{ - if (!band) - return NULL; - - if (--band->ref > 0) { - isl_schedule_free(band->schedule); - return NULL; - } - - isl_union_pw_multi_aff_free(band->pma); - isl_band_list_free(band->children); - free(band->coincident); - free(band); - - return NULL; -} - -int isl_band_has_children(__isl_keep isl_band *band) -{ - if (!band) - return -1; - - return band->children != NULL; -} - -__isl_give isl_band_list *isl_band_get_children( - __isl_keep isl_band *band) -{ - if (!band) - return NULL; - if (!band->children) - isl_die(isl_band_get_ctx(band), isl_error_invalid, - "band has no children", return NULL); - return isl_band_list_dup(band->children); -} - -int isl_band_n_member(__isl_keep isl_band *band) -{ - return band ? band->n : 0; -} - -/* Is the given scheduling dimension coincident within the band and - * with respect to the coincidence constraints. - */ -int isl_band_member_is_coincident(__isl_keep isl_band *band, int pos) -{ - if (!band) - return -1; - - if (pos < 0 || pos >= band->n) - isl_die(isl_band_get_ctx(band), isl_error_invalid, - "invalid member position", return -1); - - return band->coincident[pos]; -} - -/* Return the schedule that leads up to this band. - */ -__isl_give isl_union_map *isl_band_get_prefix_schedule( - __isl_keep isl_band *band) -{ - isl_union_set *domain; - isl_union_pw_multi_aff *prefix; - isl_band *a; - - if (!band) - return NULL; - - prefix = isl_union_pw_multi_aff_copy(band->pma); - domain = isl_union_pw_multi_aff_domain(prefix); - prefix = isl_union_pw_multi_aff_from_domain(domain); - - for (a = band->parent; a; a = a->parent) { - isl_union_pw_multi_aff *partial; - - partial = isl_union_pw_multi_aff_copy(a->pma); - prefix = isl_union_pw_multi_aff_flat_range_product(partial, - prefix); - } - - return isl_union_map_from_union_pw_multi_aff(prefix); -} - -/* Return the schedule of the band in isolation. - */ -__isl_give isl_union_pw_multi_aff * -isl_band_get_partial_schedule_union_pw_multi_aff(__isl_keep isl_band *band) -{ - return band ? isl_union_pw_multi_aff_copy(band->pma) : NULL; -} - -/* Return the schedule of the band in isolation. - */ -__isl_give isl_union_map *isl_band_get_partial_schedule( - __isl_keep isl_band *band) -{ - isl_union_pw_multi_aff *sched; - - sched = isl_band_get_partial_schedule_union_pw_multi_aff(band); - return isl_union_map_from_union_pw_multi_aff(sched); -} - -__isl_give isl_union_pw_multi_aff * -isl_band_get_suffix_schedule_union_pw_multi_aff(__isl_keep isl_band *band); - -/* Return the schedule for the given band list. - * For each band in the list, the schedule is composed of the partial - * and suffix schedules of that band. - */ -__isl_give isl_union_pw_multi_aff * -isl_band_list_get_suffix_schedule_union_pw_multi_aff( - __isl_keep isl_band_list *list) -{ - isl_ctx *ctx; - int i, n; - isl_space *space; - isl_union_pw_multi_aff *suffix; - - if (!list) - return NULL; - - ctx = isl_band_list_get_ctx(list); - space = isl_space_alloc(ctx, 0, 0, 0); - suffix = isl_union_pw_multi_aff_empty(space); - n = isl_band_list_n_band(list); - for (i = 0; i < n; ++i) { - isl_band *el; - isl_union_pw_multi_aff *partial; - isl_union_pw_multi_aff *suffix_i; - - el = isl_band_list_get_band(list, i); - partial = isl_band_get_partial_schedule_union_pw_multi_aff(el); - suffix_i = isl_band_get_suffix_schedule_union_pw_multi_aff(el); - suffix_i = isl_union_pw_multi_aff_flat_range_product( - partial, suffix_i); - suffix = isl_union_pw_multi_aff_union_add(suffix, suffix_i); - - isl_band_free(el); - } - - return suffix; -} - -/* Return the schedule for the given band list. - * For each band in the list, the schedule is composed of the partial - * and suffix schedules of that band. - */ -__isl_give isl_union_map *isl_band_list_get_suffix_schedule( - __isl_keep isl_band_list *list) -{ - isl_union_pw_multi_aff *suffix; - - suffix = isl_band_list_get_suffix_schedule_union_pw_multi_aff(list); - return isl_union_map_from_union_pw_multi_aff(suffix); -} - -/* Return the schedule for the forest underneath the given band. - */ -__isl_give isl_union_pw_multi_aff * -isl_band_get_suffix_schedule_union_pw_multi_aff(__isl_keep isl_band *band) -{ - isl_union_pw_multi_aff *suffix; - - if (!band) - return NULL; - - if (!isl_band_has_children(band)) { - isl_union_set *domain; - - suffix = isl_union_pw_multi_aff_copy(band->pma); - domain = isl_union_pw_multi_aff_domain(suffix); - suffix = isl_union_pw_multi_aff_from_domain(domain); - } else { - isl_band_list *list; - - list = isl_band_get_children(band); - suffix = - isl_band_list_get_suffix_schedule_union_pw_multi_aff(list); - isl_band_list_free(list); - } - - return suffix; -} - -/* Return the schedule for the forest underneath the given band. - */ -__isl_give isl_union_map *isl_band_get_suffix_schedule( - __isl_keep isl_band *band) -{ - isl_union_pw_multi_aff *suffix; - - suffix = isl_band_get_suffix_schedule_union_pw_multi_aff(band); - return isl_union_map_from_union_pw_multi_aff(suffix); -} - -/* Call "fn" on each band (recursively) in the list - * in depth-first post-order. - */ -int isl_band_list_foreach_band(__isl_keep isl_band_list *list, - int (*fn)(__isl_keep isl_band *band, void *user), void *user) -{ - int i, n; - - if (!list) - return -1; - - n = isl_band_list_n_band(list); - for (i = 0; i < n; ++i) { - isl_band *band; - int r = 0; - - band = isl_band_list_get_band(list, i); - if (isl_band_has_children(band)) { - isl_band_list *children; - - children = isl_band_get_children(band); - r = isl_band_list_foreach_band(children, fn, user); - isl_band_list_free(children); - } - - if (!band) - r = -1; - if (r == 0) - r = fn(band, user); - - isl_band_free(band); - if (r) - return r; - } - - return 0; -} - -/* Internal data used during the construction of the schedule - * for the tile loops. - * - * sizes contains the tile sizes - * scale is set if the tile loops should be scaled - * tiled collects the result for a single statement - * res collects the result for all statements - */ -struct isl_band_tile_data { - isl_multi_val *sizes; - isl_union_pw_multi_aff *res; - isl_pw_multi_aff *tiled; - int scale; -}; - -/* Given part of the schedule of a band, construct the corresponding - * schedule for the tile loops based on the tile sizes in data->sizes - * and add the result to data->tiled. - * - * If data->scale is set, then dimension i of the schedule will be - * of the form - * - * m_i * floor(s_i(x) / m_i) - * - * where s_i(x) refers to the original schedule and m_i is the tile size. - * If data->scale is not set, then dimension i of the schedule will be - * of the form - * - * floor(s_i(x) / m_i) - * - */ -static isl_stat multi_aff_tile(__isl_take isl_set *set, - __isl_take isl_multi_aff *ma, void *user) -{ - struct isl_band_tile_data *data = user; - isl_pw_multi_aff *pma; - int i, n; - isl_val *v; - - n = isl_multi_aff_dim(ma, isl_dim_out); - - for (i = 0; i < n; ++i) { - isl_aff *aff; - - aff = isl_multi_aff_get_aff(ma, i); - v = isl_multi_val_get_val(data->sizes, i); - - aff = isl_aff_scale_down_val(aff, isl_val_copy(v)); - aff = isl_aff_floor(aff); - if (data->scale) - aff = isl_aff_scale_val(aff, isl_val_copy(v)); - isl_val_free(v); - - ma = isl_multi_aff_set_aff(ma, i, aff); - } - - pma = isl_pw_multi_aff_alloc(set, ma); - data->tiled = isl_pw_multi_aff_union_add(data->tiled, pma); - - return isl_stat_ok; -} - -/* Given part of the schedule of a band, construct the corresponding - * schedule for the tile loops based on the tile sizes in data->sizes - * and add the result to data->res. - */ -static isl_stat pw_multi_aff_tile(__isl_take isl_pw_multi_aff *pma, void *user) -{ - struct isl_band_tile_data *data = user; - - data->tiled = isl_pw_multi_aff_empty(isl_pw_multi_aff_get_space(pma)); - - if (isl_pw_multi_aff_foreach_piece(pma, &multi_aff_tile, data) < 0) - goto error; - - isl_pw_multi_aff_free(pma); - data->res = isl_union_pw_multi_aff_add_pw_multi_aff(data->res, - data->tiled); - - return isl_stat_ok; -error: - isl_pw_multi_aff_free(pma); - isl_pw_multi_aff_free(data->tiled); - return isl_stat_error; -} - -/* Given the schedule of a band, construct the corresponding - * schedule for the tile loops based on the given tile sizes - * and return the result. - */ -static isl_union_pw_multi_aff *isl_union_pw_multi_aff_tile( - __isl_take isl_union_pw_multi_aff *sched, - __isl_keep isl_multi_val *sizes) -{ - isl_ctx *ctx; - isl_space *space; - struct isl_band_tile_data data = { sizes }; - - ctx = isl_multi_val_get_ctx(sizes); - - space = isl_union_pw_multi_aff_get_space(sched); - data.res = isl_union_pw_multi_aff_empty(space); - data.scale = isl_options_get_tile_scale_tile_loops(ctx); - - if (isl_union_pw_multi_aff_foreach_pw_multi_aff(sched, - &pw_multi_aff_tile, &data) < 0) - goto error; - - isl_union_pw_multi_aff_free(sched); - return data.res; -error: - isl_union_pw_multi_aff_free(sched); - isl_union_pw_multi_aff_free(data.res); - return NULL; -} - -/* Extract the range space from "pma" and store it in *user. - * All entries are expected to have the same range space, so we can - * stop after extracting the range space from the first entry. - */ -static isl_stat extract_range_space(__isl_take isl_pw_multi_aff *pma, - void *user) -{ - isl_space **space = user; - - *space = isl_space_range(isl_pw_multi_aff_get_space(pma)); - isl_pw_multi_aff_free(pma); - - return isl_stat_error; -} - -/* Extract the range space of "band". All entries in band->pma should - * have the same range space. Furthermore, band->pma should have at least - * one entry. - */ -static __isl_give isl_space *band_get_range_space(__isl_keep isl_band *band) -{ - isl_space *space; - - if (!band) - return NULL; - - space = NULL; - isl_union_pw_multi_aff_foreach_pw_multi_aff(band->pma, - &extract_range_space, &space); - - return space; -} - -/* Construct and return an isl_multi_val in the given space, with as entries - * the first elements of "v", padded with ones if the size of "v" is smaller - * than the dimension of "space". - */ -static __isl_give isl_multi_val *multi_val_from_vec(__isl_take isl_space *space, - __isl_take isl_vec *v) -{ - isl_ctx *ctx; - isl_multi_val *mv; - int i, n, size; - - if (!space || !v) - goto error; - - ctx = isl_space_get_ctx(space); - mv = isl_multi_val_zero(space); - n = isl_multi_val_dim(mv, isl_dim_set); - size = isl_vec_size(v); - if (n < size) - size = n; - - for (i = 0; i < size; ++i) { - isl_val *val = isl_vec_get_element_val(v, i); - mv = isl_multi_val_set_val(mv, i, val); - } - for (i = size; i < n; ++i) - mv = isl_multi_val_set_val(mv, i, isl_val_one(ctx)); - - isl_vec_free(v); - return mv; -error: - isl_space_free(space); - isl_vec_free(v); - return NULL; -} - -/* Tile the given band using the specified tile sizes. - * The given band is modified to refer to the tile loops and - * a child band is created to refer to the point loops. - * The children of this point loop band are the children - * of the original band. - * - * If the scale tile loops option is set, then the tile loops - * are scaled by the tile sizes. If the shift point loops option is set, - * then the point loops are shifted to start at zero. - * In particular, these options affect the tile and point loop schedules - * as follows - * - * scale shift original tile point - * - * 0 0 i floor(i/s) i - * 1 0 i s * floor(i/s) i - * 0 1 i floor(i/s) i - s * floor(i/s) - * 1 1 i s * floor(i/s) i - s * floor(i/s) - */ -int isl_band_tile(__isl_keep isl_band *band, __isl_take isl_vec *sizes) -{ - isl_ctx *ctx; - isl_band *child; - isl_band_list *list = NULL; - isl_union_pw_multi_aff *sched = NULL, *child_sched = NULL; - isl_space *space; - isl_multi_val *mv_sizes; - - if (!band || !sizes) - goto error; - - ctx = isl_vec_get_ctx(sizes); - child = isl_band_dup(band); - list = isl_band_list_alloc(ctx, 1); - list = isl_band_list_add(list, child); - if (!list) - goto error; - - space = band_get_range_space(band); - mv_sizes = multi_val_from_vec(space, isl_vec_copy(sizes)); - sched = isl_union_pw_multi_aff_copy(band->pma); - sched = isl_union_pw_multi_aff_tile(sched, mv_sizes); - - child_sched = isl_union_pw_multi_aff_copy(child->pma); - if (isl_options_get_tile_shift_point_loops(ctx)) { - isl_union_pw_multi_aff *scaled; - scaled = isl_union_pw_multi_aff_copy(sched); - if (!isl_options_get_tile_scale_tile_loops(ctx)) - scaled = isl_union_pw_multi_aff_scale_multi_val(scaled, - isl_multi_val_copy(mv_sizes)); - child_sched = isl_union_pw_multi_aff_sub(child_sched, scaled); - } - isl_multi_val_free(mv_sizes); - if (!sched || !child_sched) - goto error; - - child->children = band->children; - band->children = list; - child->parent = band; - isl_union_pw_multi_aff_free(band->pma); - band->pma = sched; - isl_union_pw_multi_aff_free(child->pma); - child->pma = child_sched; - - isl_vec_free(sizes); - return 0; -error: - isl_union_pw_multi_aff_free(sched); - isl_union_pw_multi_aff_free(child_sched); - isl_band_list_free(list); - isl_vec_free(sizes); - return -1; -} - -/* Internal data structure used inside isl_union_pw_multi_aff_drop. - * - * "pos" is the position of the first dimension to drop. - * "n" is the number of dimensions to drop. - * "res" accumulates the result. - */ -struct isl_union_pw_multi_aff_drop_data { - int pos; - int n; - isl_union_pw_multi_aff *res; -}; - -/* Drop the data->n output dimensions starting at data->pos from "pma" - * and add the result to data->res. - */ -static isl_stat pw_multi_aff_drop(__isl_take isl_pw_multi_aff *pma, void *user) -{ - struct isl_union_pw_multi_aff_drop_data *data = user; - - pma = isl_pw_multi_aff_drop_dims(pma, isl_dim_out, data->pos, data->n); - - data->res = isl_union_pw_multi_aff_add_pw_multi_aff(data->res, pma); - if (!data->res) - return isl_stat_error; - - return isl_stat_ok; -} - -/* Drop the "n" output dimensions starting at "pos" from "sched". - */ -static isl_union_pw_multi_aff *isl_union_pw_multi_aff_drop( - __isl_take isl_union_pw_multi_aff *sched, int pos, int n) -{ - isl_space *space; - struct isl_union_pw_multi_aff_drop_data data = { pos, n }; - - space = isl_union_pw_multi_aff_get_space(sched); - data.res = isl_union_pw_multi_aff_empty(space); - - if (isl_union_pw_multi_aff_foreach_pw_multi_aff(sched, - &pw_multi_aff_drop, &data) < 0) - data.res = isl_union_pw_multi_aff_free(data.res); - - isl_union_pw_multi_aff_free(sched); - return data.res; -} - -/* Drop the "n" dimensions starting at "pos" from "band". - */ -static int isl_band_drop(__isl_keep isl_band *band, int pos, int n) -{ - int i; - isl_union_pw_multi_aff *sched; - - if (!band) - return -1; - if (n == 0) - return 0; - - sched = isl_union_pw_multi_aff_copy(band->pma); - sched = isl_union_pw_multi_aff_drop(sched, pos, n); - if (!sched) - return -1; - - isl_union_pw_multi_aff_free(band->pma); - band->pma = sched; - - for (i = pos + n; i < band->n; ++i) - band->coincident[i - n] = band->coincident[i]; - - band->n -= n; - - return 0; -} - -/* Split the given band into two nested bands, one with the first "pos" - * dimensions of "band" and one with the remaining band->n - pos dimensions. - */ -int isl_band_split(__isl_keep isl_band *band, int pos) -{ - isl_ctx *ctx; - isl_band *child; - isl_band_list *list; - - if (!band) - return -1; - - ctx = isl_band_get_ctx(band); - - if (pos < 0 || pos > band->n) - isl_die(ctx, isl_error_invalid, "position out of bounds", - return -1); - - child = isl_band_dup(band); - if (isl_band_drop(child, 0, pos) < 0) - child = isl_band_free(child); - list = isl_band_list_alloc(ctx, 1); - list = isl_band_list_add(list, child); - if (!list) - return -1; - - if (isl_band_drop(band, pos, band->n - pos) < 0) { - isl_band_list_free(list); - return -1; - } - - child->children = band->children; - band->children = list; - child->parent = band; - - return 0; -} - -__isl_give isl_printer *isl_printer_print_band(__isl_take isl_printer *p, - __isl_keep isl_band *band) -{ - isl_union_map *prefix, *partial, *suffix; - - prefix = isl_band_get_prefix_schedule(band); - partial = isl_band_get_partial_schedule(band); - suffix = isl_band_get_suffix_schedule(band); - - p = isl_printer_print_str(p, "("); - p = isl_printer_print_union_map(p, prefix); - p = isl_printer_print_str(p, ","); - p = isl_printer_print_union_map(p, partial); - p = isl_printer_print_str(p, ","); - p = isl_printer_print_union_map(p, suffix); - p = isl_printer_print_str(p, ")"); - - isl_union_map_free(prefix); - isl_union_map_free(partial); - isl_union_map_free(suffix); - - return p; -} diff --git a/polly/lib/External/isl/isl_band_private.h b/polly/lib/External/isl/isl_band_private.h deleted file mode 100644 index 8b9c0b77da75..000000000000 --- a/polly/lib/External/isl/isl_band_private.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef ISL_BAND_PRIVATE_H -#define ISL_BAND_PRIVATE_H - -#include -#include -#include -#include - -/* Information about a band within a schedule. - * - * n is the number of scheduling dimensions within the band. - * coincident is an array of length n, indicating whether a scheduling dimension - * satisfies the coincidence constraints in the sense that - * the corresponding dependence distances are zero. - * pma is the partial schedule corresponding to this band. - * schedule is the schedule that contains this band. - * parent is the parent of this band (or NULL if the band is a root). - * children are the children of this band (or NULL if the band is a leaf). - * - * To avoid circular dependences in the reference counting, - * the schedule and parent pointers are not reference counted. - * isl_band_copy increments the reference count of schedule to ensure - * that outside references to the band keep the schedule alive. - */ -struct isl_band { - int ref; - - int n; - int *coincident; - - isl_union_pw_multi_aff *pma; - isl_schedule *schedule; - isl_band *parent; - isl_band_list *children; -}; - -#undef EL -#define EL isl_band - -#include - -__isl_give isl_band *isl_band_alloc(isl_ctx *ctx); - -__isl_give isl_union_map *isl_band_list_get_suffix_schedule( - __isl_keep isl_band_list *list); - -#endif diff --git a/polly/lib/External/isl/isl_coalesce.c b/polly/lib/External/isl/isl_coalesce.c index 476f8154981c..598eac23d7c1 100644 --- a/polly/lib/External/isl/isl_coalesce.c +++ b/polly/lib/External/isl/isl_coalesce.c @@ -196,6 +196,82 @@ struct isl_coalesce_info { int *ineq; }; +/* Is there any (half of an) equality constraint in the description + * of the basic map represented by "info" that + * has position "status" with respect to the other basic map? + */ +static int any_eq(struct isl_coalesce_info *info, int status) +{ + unsigned n_eq; + + n_eq = isl_basic_map_n_equality(info->bmap); + return any(info->eq, 2 * n_eq, status); +} + +/* Is there any inequality constraint in the description + * of the basic map represented by "info" that + * has position "status" with respect to the other basic map? + */ +static int any_ineq(struct isl_coalesce_info *info, int status) +{ + unsigned n_ineq; + + n_ineq = isl_basic_map_n_inequality(info->bmap); + return any(info->ineq, n_ineq, status); +} + +/* Return the position of the first half on an equality constraint + * in the description of the basic map represented by "info" that + * has position "status" with respect to the other basic map. + * The returned value is twice the position of the equality constraint + * plus zero for the negative half and plus one for the positive half. + * Return -1 if there is no such entry. + */ +static int find_eq(struct isl_coalesce_info *info, int status) +{ + unsigned n_eq; + + n_eq = isl_basic_map_n_equality(info->bmap); + return find(info->eq, 2 * n_eq, status); +} + +/* Return the position of the first inequality constraint in the description + * of the basic map represented by "info" that + * has position "status" with respect to the other basic map. + * Return -1 if there is no such entry. + */ +static int find_ineq(struct isl_coalesce_info *info, int status) +{ + unsigned n_ineq; + + n_ineq = isl_basic_map_n_inequality(info->bmap); + return find(info->ineq, n_ineq, status); +} + +/* Return the number of (halves of) equality constraints in the description + * of the basic map represented by "info" that + * have position "status" with respect to the other basic map. + */ +static int count_eq(struct isl_coalesce_info *info, int status) +{ + unsigned n_eq; + + n_eq = isl_basic_map_n_equality(info->bmap); + return count(info->eq, 2 * n_eq, status); +} + +/* Return the number of inequality constraints in the description + * of the basic map represented by "info" that + * have position "status" with respect to the other basic map. + */ +static int count_ineq(struct isl_coalesce_info *info, int status) +{ + unsigned n_ineq; + + n_ineq = isl_basic_map_n_inequality(info->bmap); + return count(info->ineq, n_ineq, status); +} + /* Are all non-redundant constraints of the basic map represented by "info" * either valid or cut constraints with respect to the other basic map? */ @@ -654,7 +730,7 @@ static enum isl_change is_adj_ineq_extension(int i, int j, if (isl_tab_extend_cons(info[i].tab, 1 + info[j].bmap->n_ineq) < 0) return isl_change_error; - k = find(info[i].ineq, info[i].bmap->n_ineq, STATUS_ADJ_INEQ); + k = find_ineq(&info[i], STATUS_ADJ_INEQ); if (k < 0) isl_die(isl_basic_map_get_ctx(info[i].bmap), isl_error_internal, "info[i].ineq should have exactly one STATUS_ADJ_INEQ", @@ -732,16 +808,14 @@ static enum isl_change check_adj_ineq(int i, int j, int count_i, count_j; int cut_i, cut_j; - count_i = count(info[i].ineq, info[i].bmap->n_ineq, STATUS_ADJ_INEQ); - count_j = count(info[j].ineq, info[j].bmap->n_ineq, STATUS_ADJ_INEQ); + count_i = count_ineq(&info[i], STATUS_ADJ_INEQ); + count_j = count_ineq(&info[j], STATUS_ADJ_INEQ); if (count_i != 1 && count_j != 1) return isl_change_none; - cut_i = any(info[i].eq, 2 * info[i].bmap->n_eq, STATUS_CUT) || - any(info[i].ineq, info[i].bmap->n_ineq, STATUS_CUT); - cut_j = any(info[j].eq, 2 * info[j].bmap->n_eq, STATUS_CUT) || - any(info[j].ineq, info[j].bmap->n_ineq, STATUS_CUT); + cut_i = any_eq(&info[i], STATUS_CUT) || any_ineq(&info[i], STATUS_CUT); + cut_j = any_eq(&info[j], STATUS_CUT) || any_ineq(&info[j], STATUS_CUT); if (!cut_i && !cut_j && count_i == 1 && count_j == 1) return fuse(i, j, info, NULL, 0, 0); @@ -1712,8 +1786,7 @@ static enum isl_change can_wrap_in_set(int i, int j, ISL_F_ISSET(info[j].bmap, ISL_BASIC_MAP_RATIONAL)) return isl_change_none; - n = count(info[i].eq, 2 * info[i].bmap->n_eq, STATUS_CUT); - n += count(info[i].ineq, info[i].bmap->n_ineq, STATUS_CUT); + n = count_eq(&info[i], STATUS_CUT) + count_ineq(&info[i], STATUS_CUT); if (n == 0) return isl_change_none; @@ -1825,9 +1898,9 @@ static enum isl_change check_single_adj_eq(int i, int j, isl_ctx *ctx; isl_bool try_relax; - n_cut = count(info[i].ineq, info[i].bmap->n_ineq, STATUS_CUT); + n_cut = count_ineq(&info[i], STATUS_CUT); - k = find(info[i].ineq, info[i].bmap->n_ineq, STATUS_ADJ_EQ); + k = find_ineq(&info[i], STATUS_ADJ_EQ); if (n_cut > 0) { ctx = isl_basic_map_get_ctx(info[i].bmap); @@ -1855,7 +1928,7 @@ static enum isl_change check_single_adj_eq(int i, int j, } /* At least one of the basic maps has an equality that is adjacent - * to inequality. Make sure that only one of the basic maps has + * to an inequality. Make sure that only one of the basic maps has * such an equality and that the other basic map has exactly one * inequality adjacent to an equality. * If the other basic map does not have such an inequality, then @@ -1867,32 +1940,63 @@ static enum isl_change check_single_adj_eq(int i, int j, static enum isl_change check_adj_eq(int i, int j, struct isl_coalesce_info *info) { - if (any(info[i].eq, 2 * info[i].bmap->n_eq, STATUS_ADJ_INEQ) && - any(info[j].eq, 2 * info[j].bmap->n_eq, STATUS_ADJ_INEQ)) + if (any_eq(&info[i], STATUS_ADJ_INEQ) && + any_eq(&info[j], STATUS_ADJ_INEQ)) /* ADJ EQ TOO MANY */ return isl_change_none; - if (any(info[i].eq, 2 * info[i].bmap->n_eq, STATUS_ADJ_INEQ)) + if (any_eq(&info[i], STATUS_ADJ_INEQ)) return check_adj_eq(j, i, info); /* j has an equality adjacent to an inequality in i */ - if (count(info[i].ineq, info[i].bmap->n_ineq, STATUS_ADJ_EQ) != 1) { + if (count_ineq(&info[i], STATUS_ADJ_EQ) != 1) { if (all_valid_or_cut(&info[i])) return can_wrap_in_set(i, j, info); return isl_change_none; } - if (any(info[i].eq, 2 * info[i].bmap->n_eq, STATUS_CUT)) + if (any_eq(&info[i], STATUS_CUT)) return isl_change_none; - if (any(info[j].ineq, info[j].bmap->n_ineq, STATUS_ADJ_EQ) || - any(info[i].ineq, info[i].bmap->n_ineq, STATUS_ADJ_INEQ) || - any(info[j].ineq, info[j].bmap->n_ineq, STATUS_ADJ_INEQ)) + if (any_ineq(&info[j], STATUS_ADJ_EQ) || + any_ineq(&info[i], STATUS_ADJ_INEQ) || + any_ineq(&info[j], STATUS_ADJ_INEQ)) /* ADJ EQ TOO MANY */ return isl_change_none; return check_single_adj_eq(i, j, info); } +/* Disjunct "j" lies on a hyperplane that is adjacent to disjunct "i". + * In particular, disjunct "i" has an inequality constraint that is adjacent + * to a (combination of) equality constraint(s) of disjunct "j", + * but disjunct "j" has no explicit equality constraint adjacent + * to an inequality constraint of disjunct "i". + * + * Disjunct "i" is already known not to have any equality constraints + * that are adjacent to an equality or inequality constraint. + * Check that, other than the inequality constraint mentioned above, + * all other constraints of disjunct "i" are valid for disjunct "j". + * If so, try and wrap in disjunct "j". + */ +static enum isl_change check_ineq_adj_eq(int i, int j, + struct isl_coalesce_info *info) +{ + int k; + + if (any_eq(&info[i], STATUS_CUT)) + return isl_change_none; + if (any_ineq(&info[i], STATUS_CUT)) + return isl_change_none; + if (any_ineq(&info[i], STATUS_ADJ_INEQ)) + return isl_change_none; + if (count_ineq(&info[i], STATUS_ADJ_EQ) != 1) + return isl_change_none; + + k = find_ineq(&info[i], STATUS_ADJ_EQ); + + return can_wrap_in_facet(i, j, k, info, 0); +} + /* The two basic maps lie on adjacent hyperplanes. In particular, * basic map "i" has an equality that lies parallel to basic map "j". * Check if we can wrap the facets around the parallel hyperplanes @@ -1925,10 +2029,10 @@ static enum isl_change check_eq_adj_eq(int i, int j, struct isl_vec *bound = NULL; unsigned total = isl_basic_map_total_dim(info[i].bmap); - if (count(info[i].eq, 2 * info[i].bmap->n_eq, STATUS_ADJ_EQ) != 1) + if (count_eq(&info[i], STATUS_ADJ_EQ) != 1) detect_equalities = 1; - k = find(info[i].eq, 2 * info[i].bmap->n_eq, STATUS_ADJ_EQ); + k = find_eq(&info[i], STATUS_ADJ_EQ); set_i = set_from_updated_bmap(info[i].bmap, info[i].tab); set_j = set_from_updated_bmap(info[j].bmap, info[j].tab); @@ -2134,7 +2238,7 @@ static enum isl_change separating_equality(int i, int j, * => the pair can be replaced by the basic map containing * the inequality, with the inequality relaxed. * - * 6. there is a single adjacent pair of an inequality and an equality, + * 6. there is a single inequality adjacent to an equality, * the other constraints of the basic map containing the inequality are * "valid". Moreover, the facets corresponding to both * the inequality and the equality can be wrapped around their @@ -2168,34 +2272,34 @@ static enum isl_change coalesce_local_pair_reuse(int i, int j, set_ineq_status_in(&info[i], info[j].tab); if (info[i].bmap->n_ineq && !info[i].ineq) goto error; - if (any(info[i].ineq, info[i].bmap->n_ineq, STATUS_ERROR)) + if (any_ineq(&info[i], STATUS_ERROR)) goto error; - if (any(info[i].ineq, info[i].bmap->n_ineq, STATUS_SEPARATE)) + if (any_ineq(&info[i], STATUS_SEPARATE)) goto done; set_ineq_status_in(&info[j], info[i].tab); if (info[j].bmap->n_ineq && !info[j].ineq) goto error; - if (any(info[j].ineq, info[j].bmap->n_ineq, STATUS_ERROR)) + if (any_ineq(&info[j], STATUS_ERROR)) goto error; - if (any(info[j].ineq, info[j].bmap->n_ineq, STATUS_SEPARATE)) + if (any_ineq(&info[j], STATUS_SEPARATE)) goto done; set_eq_status_in(&info[i], info[j].tab); if (info[i].bmap->n_eq && !info[i].eq) goto error; - if (any(info[i].eq, 2 * info[i].bmap->n_eq, STATUS_ERROR)) + if (any_eq(&info[i], STATUS_ERROR)) goto error; set_eq_status_in(&info[j], info[i].tab); if (info[j].bmap->n_eq && !info[j].eq) goto error; - if (any(info[j].eq, 2 * info[j].bmap->n_eq, STATUS_ERROR)) + if (any_eq(&info[j], STATUS_ERROR)) goto error; - if (any(info[i].eq, 2 * info[i].bmap->n_eq, STATUS_SEPARATE)) + if (any_eq(&info[i], STATUS_SEPARATE)) return separating_equality(i, j, info); - if (any(info[j].eq, 2 * info[j].bmap->n_eq, STATUS_SEPARATE)) + if (any_eq(&info[j], STATUS_SEPARATE)) return separating_equality(j, i, info); if (all(info[i].eq, 2 * info[i].bmap->n_eq, STATUS_VALID) && @@ -2206,23 +2310,23 @@ static enum isl_change coalesce_local_pair_reuse(int i, int j, all(info[j].ineq, info[j].bmap->n_ineq, STATUS_VALID)) { drop(&info[i]); change = isl_change_drop_first; - } else if (any(info[i].eq, 2 * info[i].bmap->n_eq, STATUS_ADJ_EQ)) { + } else if (any_eq(&info[i], STATUS_ADJ_EQ)) { change = check_eq_adj_eq(i, j, info); - } else if (any(info[j].eq, 2 * info[j].bmap->n_eq, STATUS_ADJ_EQ)) { + } else if (any_eq(&info[j], STATUS_ADJ_EQ)) { change = check_eq_adj_eq(j, i, info); - } else if (any(info[i].eq, 2 * info[i].bmap->n_eq, STATUS_ADJ_INEQ) || - any(info[j].eq, 2 * info[j].bmap->n_eq, STATUS_ADJ_INEQ)) { + } else if (any_eq(&info[i], STATUS_ADJ_INEQ) || + any_eq(&info[j], STATUS_ADJ_INEQ)) { change = check_adj_eq(i, j, info); - } else if (any(info[i].ineq, info[i].bmap->n_ineq, STATUS_ADJ_EQ) || - any(info[j].ineq, info[j].bmap->n_ineq, STATUS_ADJ_EQ)) { - /* Can't happen */ - /* BAD ADJ INEQ */ - } else if (any(info[i].ineq, info[i].bmap->n_ineq, STATUS_ADJ_INEQ) || - any(info[j].ineq, info[j].bmap->n_ineq, STATUS_ADJ_INEQ)) { + } else if (any_ineq(&info[i], STATUS_ADJ_EQ)) { + change = check_ineq_adj_eq(i, j, info); + } else if (any_ineq(&info[j], STATUS_ADJ_EQ)) { + change = check_ineq_adj_eq(j, i, info); + } else if (any_ineq(&info[i], STATUS_ADJ_INEQ) || + any_ineq(&info[j], STATUS_ADJ_INEQ)) { change = check_adj_ineq(i, j, info); } else { - if (!any(info[i].eq, 2 * info[i].bmap->n_eq, STATUS_CUT) && - !any(info[j].eq, 2 * info[j].bmap->n_eq, STATUS_CUT)) + if (!any_eq(&info[i], STATUS_CUT) && + !any_eq(&info[j], STATUS_CUT)) change = check_facets(i, j, info); if (change == isl_change_none) change = check_wrap(i, j, info); @@ -2968,20 +3072,21 @@ static enum isl_change coalesce_with_expanded_divs( if (!bmap) goto error; + info_local.bmap = bmap; info_i->eq = eq_status_in(bmap, info[j].tab); if (bmap->n_eq && !info_i->eq) goto error; - if (any(info_i->eq, 2 * bmap->n_eq, STATUS_ERROR)) + if (any_eq(info_i, STATUS_ERROR)) goto error; - if (any(info_i->eq, 2 * bmap->n_eq, STATUS_SEPARATE)) + if (any_eq(info_i, STATUS_SEPARATE)) goto done; info_i->ineq = ineq_status_in(bmap, NULL, info[j].tab); if (bmap->n_ineq && !info_i->ineq) goto error; - if (any(info_i->ineq, bmap->n_ineq, STATUS_ERROR)) + if (any_ineq(info_i, STATUS_ERROR)) goto error; - if (any(info_i->ineq, bmap->n_ineq, STATUS_SEPARATE)) + if (any_ineq(info_i, STATUS_SEPARATE)) goto done; if (all(info_i->eq, 2 * bmap->n_eq, STATUS_VALID) && diff --git a/polly/lib/External/isl/isl_config.h.in b/polly/lib/External/isl/isl_config.h.in index 27b6f94ca5f9..e2ec2ea6ab25 100644 --- a/polly/lib/External/isl/isl_config.h.in +++ b/polly/lib/External/isl/isl_config.h.in @@ -34,9 +34,6 @@ /* Define if clang/Basic/DiagnosticOptions.h exists */ #undef HAVE_BASIC_DIAGNOSTICOPTIONS_H -/* define if the compiler supports basic C++11 syntax */ -#undef HAVE_CXX11 - /* Define if Driver constructor takes CXXIsProduction argument */ #undef HAVE_CXXISPRODUCTION diff --git a/polly/lib/External/isl/isl_constraint.c b/polly/lib/External/isl/isl_constraint.c index 92a6bb89a3ad..f1b0b4eefc45 100644 --- a/polly/lib/External/isl/isl_constraint.c +++ b/polly/lib/External/isl/isl_constraint.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include diff --git a/polly/lib/External/isl/isl_constraint_private.h b/polly/lib/External/isl/isl_constraint_private.h index 26a86303934c..82f41df152e3 100644 --- a/polly/lib/External/isl/isl_constraint_private.h +++ b/polly/lib/External/isl/isl_constraint_private.h @@ -25,10 +25,5 @@ void isl_constraint_get_constant(__isl_keep isl_constraint *constraint, isl_int *v); void isl_constraint_get_coefficient(__isl_keep isl_constraint *constraint, enum isl_dim_type type, int pos, isl_int *v); -__isl_give isl_constraint *isl_constraint_set_constant( - __isl_take isl_constraint *constraint, isl_int v); -__isl_give isl_constraint *isl_constraint_set_coefficient( - __isl_take isl_constraint *constraint, - enum isl_dim_type type, int pos, isl_int v); #endif diff --git a/polly/lib/External/isl/isl_ctx.c b/polly/lib/External/isl/isl_ctx.c index 002863e2cb3f..1a57da7d2260 100644 --- a/polly/lib/External/isl/isl_ctx.c +++ b/polly/lib/External/isl/isl_ctx.c @@ -85,13 +85,27 @@ void *isl_realloc_or_die(isl_ctx *ctx, void *ptr, size_t size) return ctx ? check_non_null(ctx, realloc(ptr, size), size) : NULL; } +/* Keep track of all information about the current error ("error", "msg", + * "file", "line") in "ctx". + */ +void isl_ctx_set_full_error(isl_ctx *ctx, enum isl_error error, const char *msg, + const char *file, int line) +{ + if (!ctx) + return; + ctx->error = error; + ctx->error_msg = msg; + ctx->error_file = file; + ctx->error_line = line; +} + void isl_handle_error(isl_ctx *ctx, enum isl_error error, const char *msg, const char *file, int line) { if (!ctx) return; - isl_ctx_set_error(ctx, error); + isl_ctx_set_full_error(ctx, error, msg, file, line); switch (ctx->opt->on_error) { case ISL_ON_ERROR_WARN: @@ -202,7 +216,7 @@ isl_ctx *isl_ctx_alloc_with_options(struct isl_args *args, void *user_opt) ctx->n_cached = 0; ctx->n_miss = 0; - ctx->error = isl_error_none; + isl_ctx_reset_error(ctx); ctx->operations = 0; isl_ctx_set_max_operations(ctx, ctx->opt->max_operations); @@ -278,18 +292,43 @@ struct isl_options *isl_ctx_options(isl_ctx *ctx) enum isl_error isl_ctx_last_error(isl_ctx *ctx) { - return ctx->error; + return ctx ? ctx->error : isl_error_invalid; +} + +/* Return the error message of the last error in "ctx". + */ +const char *isl_ctx_last_error_msg(isl_ctx *ctx) +{ + return ctx ? ctx->error_msg : NULL; +} + +/* Return the file name where the last error in "ctx" occurred. + */ +const char *isl_ctx_last_error_file(isl_ctx *ctx) +{ + return ctx ? ctx->error_file : NULL; +} + +/* Return the line number where the last error in "ctx" occurred. + */ +int isl_ctx_last_error_line(isl_ctx *ctx) +{ + return ctx ? ctx->error_line : -1; } void isl_ctx_reset_error(isl_ctx *ctx) { + if (!ctx) + return; ctx->error = isl_error_none; + ctx->error_msg = NULL; + ctx->error_file = NULL; + ctx->error_line = -1; } void isl_ctx_set_error(isl_ctx *ctx, enum isl_error error) { - if (ctx) - ctx->error = error; + isl_ctx_set_full_error(ctx, error, NULL, NULL, -1); } void isl_ctx_abort(isl_ctx *ctx) diff --git a/polly/lib/External/isl/isl_ctx_private.h b/polly/lib/External/isl/isl_ctx_private.h index b4bb2a5e46c5..7c66f36c999e 100644 --- a/polly/lib/External/isl/isl_ctx_private.h +++ b/polly/lib/External/isl/isl_ctx_private.h @@ -1,6 +1,13 @@ #include #include +/* "error" stores the last error that has occurred. + * It is reset to isl_error_none by isl_ctx_reset_error. + * "error_msg" stores the error message of the last error, + * while "error_file" and "error_line" specify where the last error occurred. + * "error_msg" and "error_file" always point to statically allocated + * strings (if not NULL). + */ struct isl_ctx { int ref; @@ -24,6 +31,9 @@ struct isl_ctx { struct isl_hash_table id_table; enum isl_error error; + const char *error_msg; + const char *error_file; + int error_line; int abort; diff --git a/polly/lib/External/isl/isl_deprecated.c b/polly/lib/External/isl/isl_deprecated.c index 6c21f7d748d1..f65be1f8d775 100644 --- a/polly/lib/External/isl/isl_deprecated.c +++ b/polly/lib/External/isl/isl_deprecated.c @@ -1,14 +1,4 @@ #include -#include - -/* This function was never documented and has been replaced by - * isl_basic_set_add_dims. - */ -__isl_give isl_basic_set *isl_basic_set_add(__isl_take isl_basic_set *bset, - enum isl_dim_type type, unsigned n) -{ - return isl_basic_set_add_dims(bset, type, n); -} /* This function was replaced by isl_constraint_alloc_equality. */ diff --git a/polly/lib/External/isl/isl_flow.c b/polly/lib/External/isl/isl_flow.c index 37a29b0d9c6f..946be84e4b0b 100644 --- a/polly/lib/External/isl/isl_flow.c +++ b/polly/lib/External/isl/isl_flow.c @@ -16,6 +16,8 @@ * and Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France */ +#include +#include #include #include #include diff --git a/polly/lib/External/isl/isl_fold.c b/polly/lib/External/isl/isl_fold.c index 1ba881503783..be5c7f75a05b 100644 --- a/polly/lib/External/isl/isl_fold.c +++ b/polly/lib/External/isl/isl_fold.c @@ -20,7 +20,6 @@ #include #include #include -#include enum isl_fold isl_fold_type_negate(enum isl_fold type) { diff --git a/polly/lib/External/isl/isl_hide_deprecated.h b/polly/lib/External/isl/isl_hide_deprecated.h deleted file mode 100644 index 344a368600dc..000000000000 --- a/polly/lib/External/isl/isl_hide_deprecated.h +++ /dev/null @@ -1,52 +0,0 @@ -#define isl_aff_get_constant isl_gmp_aff_get_constant -#define isl_aff_get_coefficient isl_gmp_aff_get_coefficient -#define isl_aff_get_denominator isl_gmp_aff_get_denominator -#define isl_aff_set_constant isl_gmp_aff_set_constant -#define isl_aff_set_coefficient isl_gmp_aff_set_coefficient -#define isl_aff_set_denominator isl_gmp_aff_set_denominator -#define isl_aff_add_constant isl_gmp_aff_add_constant -#define isl_aff_add_constant_num isl_gmp_aff_add_constant_num -#define isl_aff_add_coefficient isl_gmp_aff_add_coefficient -#define isl_aff_mod isl_gmp_aff_mod -#define isl_aff_scale isl_gmp_aff_scale -#define isl_aff_scale_down isl_gmp_aff_scale_down -#define isl_pw_aff_mod isl_gmp_pw_aff_mod -#define isl_pw_aff_scale isl_gmp_pw_aff_scale -#define isl_pw_aff_scale_down isl_gmp_pw_aff_scale_down -#define isl_multi_aff_scale isl_gmp_multi_aff_scale -#define isl_ast_expr_get_int isl_gmp_ast_expr_get_int -#define isl_constraint_get_constant isl_gmp_constraint_get_constant -#define isl_constraint_get_coefficient isl_gmp_constraint_get_coefficient -#define isl_constraint_set_constant isl_gmp_constraint_set_constant -#define isl_constraint_set_coefficient isl_gmp_constraint_set_coefficient -#define isl_basic_set_max isl_gmp_basic_set_max -#define isl_set_min isl_gmp_set_min -#define isl_set_max isl_gmp_set_max -#define isl_gmp_hash isl_gmp_gmp_hash -#define isl_basic_map_plain_is_fixed isl_gmp_basic_map_plain_is_fixed -#define isl_map_fix isl_gmp_map_fix -#define isl_map_plain_is_fixed isl_gmp_map_plain_is_fixed -#define isl_map_fixed_power isl_gmp_map_fixed_power -#define isl_mat_get_element isl_gmp_mat_get_element -#define isl_mat_set_element isl_gmp_mat_set_element -#define isl_point_get_coordinate isl_gmp_point_get_coordinate -#define isl_point_set_coordinate isl_gmp_point_set_coordinate -#define isl_qpolynomial_rat_cst_on_domain isl_gmp_qpolynomial_rat_cst_on_domain -#define isl_qpolynomial_is_cst isl_gmp_qpolynomial_is_cst -#define isl_qpolynomial_scale isl_gmp_qpolynomial_scale -#define isl_term_get_num isl_gmp_term_get_num -#define isl_term_get_den isl_gmp_term_get_den -#define isl_qpolynomial_fold_scale isl_gmp_qpolynomial_fold_scale -#define isl_pw_qpolynomial_fold_fix_dim isl_gmp_pw_qpolynomial_fold_fix_dim -#define isl_basic_set_fix isl_gmp_basic_set_fix -#define isl_set_lower_bound isl_gmp_set_lower_bound -#define isl_set_upper_bound isl_gmp_set_upper_bound -#define isl_set_fix isl_gmp_set_fix -#define isl_set_plain_is_fixed isl_gmp_set_plain_is_fixed -#define isl_union_map_fixed_power isl_gmp_union_map_fixed_power -#define isl_val_int_from_isl_int isl_gmp_val_int_from_isl_int -#define isl_val_get_num_isl_int isl_gmp_val_get_num_isl_int -#define isl_vec_get_element isl_gmp_vec_get_element -#define isl_vec_set_element isl_gmp_vec_set_element -#define isl_vec_set isl_gmp_vec_set -#define isl_vec_fdiv_r isl_gmp_vec_fdiv_r diff --git a/polly/lib/External/isl/isl_ilp.c b/polly/lib/External/isl/isl_ilp.c index eee294ea07fb..d517290ede60 100644 --- a/polly/lib/External/isl/isl_ilp.c +++ b/polly/lib/External/isl/isl_ilp.c @@ -21,7 +21,6 @@ #include #include #include -#include /* Given a basic set "bset", construct a basic set U such that for * each element x in U, the whole unit box positioned at x is inside @@ -506,24 +505,6 @@ enum isl_lp_result isl_set_opt(__isl_keep isl_set *set, int max, return res; } -enum isl_lp_result isl_basic_set_max(__isl_keep isl_basic_set *bset, - __isl_keep isl_aff *obj, isl_int *opt) -{ - return isl_basic_set_opt(bset, 1, obj, opt); -} - -enum isl_lp_result isl_set_max(__isl_keep isl_set *set, - __isl_keep isl_aff *obj, isl_int *opt) -{ - return isl_set_opt(set, 1, obj, opt); -} - -enum isl_lp_result isl_set_min(__isl_keep isl_set *set, - __isl_keep isl_aff *obj, isl_int *opt) -{ - return isl_set_opt(set, 0, obj, opt); -} - /* Convert the result of a function that returns an isl_lp_result * to an isl_val. The numerator of "v" is set to the optimal value * if lp_res is isl_lp_ok. "max" is set if a maximum was computed. @@ -835,3 +816,33 @@ __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 the maximal value attained by the given set dimension, + * independently of the parameter values and of any other dimensions. + * + * Return infinity if the optimal value is unbounded and + * NaN if "bset" is empty. + */ +__isl_give isl_val *isl_basic_set_dim_max_val(__isl_take isl_basic_set *bset, + int pos) +{ + isl_local_space *ls; + isl_aff *obj; + isl_val *v; + + if (!bset) + return NULL; + if (pos < 0 || pos >= isl_basic_set_dim(bset, isl_dim_set)) + isl_die(isl_basic_set_get_ctx(bset), isl_error_invalid, + "position out of bounds", goto error); + ls = isl_local_space_from_space(isl_basic_set_get_space(bset)); + obj = isl_aff_var_on_domain(ls, isl_dim_set, pos); + v = isl_basic_set_max_val(bset, obj); + isl_aff_free(obj); + isl_basic_set_free(bset); + + return v; +error: + isl_basic_set_free(bset); + return NULL; +} diff --git a/polly/lib/External/isl/isl_input.c b/polly/lib/External/isl/isl_input.c index e122053e273e..d460b06880d1 100644 --- a/polly/lib/External/isl/isl_input.c +++ b/polly/lib/External/isl/isl_input.c @@ -3122,7 +3122,7 @@ static __isl_give isl_set *read_aff_domain(__isl_keep isl_stream *s, tok = isl_stream_next_token(s); if (tok && (tok->type == ISL_TOKEN_IDENT || tok->is_keyword)) { isl_stream_push_token(s, tok); - return read_map_tuple(s, dom, isl_dim_set, v, 1, 0); + return read_map_tuple(s, dom, isl_dim_set, v, 0, 0); } if (!tok || tok->type != '[') { isl_stream_error(s, tok, "expecting '['"); @@ -3134,7 +3134,7 @@ static __isl_give isl_set *read_aff_domain(__isl_keep isl_stream *s, isl_stream_push_token(s, tok2); if (is_empty || next_is_tuple(s) || next_is_fresh_ident(s, v)) { isl_stream_push_token(s, tok); - dom = read_map_tuple(s, dom, isl_dim_set, v, 1, 0); + dom = read_map_tuple(s, dom, isl_dim_set, v, 0, 0); } else isl_stream_push_token(s, tok); diff --git a/polly/lib/External/isl/isl_int_imath.h b/polly/lib/External/isl/isl_int_imath.h index 73d6379db8ac..ed314b65460d 100644 --- a/polly/lib/External/isl/isl_int_imath.h +++ b/polly/lib/External/isl/isl_int_imath.h @@ -1,8 +1,6 @@ #ifndef ISL_INT_IMATH_H #define ISL_INT_IMATH_H -#include "isl_hide_deprecated.h" - #include /* isl_int is the basic integer type, implemented with imath's mp_int. */ diff --git a/polly/lib/External/isl/isl_list_templ.c b/polly/lib/External/isl/isl_list_templ.c index 7d0c5446d20b..b9b582ed5fb3 100644 --- a/polly/lib/External/isl/isl_list_templ.c +++ b/polly/lib/External/isl/isl_list_templ.c @@ -15,6 +15,7 @@ #include #include +#include #define xCAT(A,B) A ## B #define CAT(A,B) xCAT(A,B) diff --git a/polly/lib/External/isl/isl_local_space.c b/polly/lib/External/isl/isl_local_space.c index 58ce84755250..bc5861f36c90 100644 --- a/polly/lib/External/isl/isl_local_space.c +++ b/polly/lib/External/isl/isl_local_space.c @@ -371,6 +371,57 @@ __isl_give isl_space *isl_local_space_get_space(__isl_keep isl_local_space *ls) return isl_space_copy(ls->dim); } +/* Return the space of "ls". + * This may be either a copy or the space itself + * if there is only one reference to "ls". + * This allows the space to be modified inplace + * if both the local space and its space have only a single reference. + * The caller is not allowed to modify "ls" between this call and + * a subsequent call to isl_local_space_restore_space. + * The only exception is that isl_local_space_free can be called instead. + */ +__isl_give isl_space *isl_local_space_take_space(__isl_keep isl_local_space *ls) +{ + isl_space *space; + + if (!ls) + return NULL; + if (ls->ref != 1) + return isl_local_space_get_space(ls); + space = ls->dim; + ls->dim = NULL; + return space; +} + +/* Set the space of "ls" to "space", where the space of "ls" may be missing + * due to a preceding call to isl_local_space_take_space. + * However, in this case, "ls" only has a single reference and + * then the call to isl_local_space_cow has no effect. + */ +__isl_give isl_local_space *isl_local_space_restore_space( + __isl_take isl_local_space *ls, __isl_take isl_space *space) +{ + if (!ls || !space) + goto error; + + if (ls->dim == space) { + isl_space_free(space); + return ls; + } + + ls = isl_local_space_cow(ls); + if (!ls) + goto error; + isl_space_free(ls->dim); + ls->dim = space; + + return ls; +error: + isl_local_space_free(ls); + isl_space_free(space); + return NULL; +} + /* Replace the identifier of the tuple of type "type" by "id". */ __isl_give isl_local_space *isl_local_space_set_tuple_id( @@ -420,6 +471,20 @@ error: return NULL; } +/* Construct a zero-dimensional local space with the given parameter domain. + */ +__isl_give isl_local_space *isl_local_space_set_from_params( + __isl_take isl_local_space *ls) +{ + isl_space *space; + + space = isl_local_space_take_space(ls); + space = isl_space_set_from_params(space); + ls = isl_local_space_restore_space(ls, space); + + return ls; +} + __isl_give isl_local_space *isl_local_space_reset_space( __isl_take isl_local_space *ls, __isl_take isl_space *dim) { diff --git a/polly/lib/External/isl/isl_map.c b/polly/lib/External/isl/isl_map.c index cb3b376071d3..47e7acd7bb87 100644 --- a/polly/lib/External/isl/isl_map.c +++ b/polly/lib/External/isl/isl_map.c @@ -43,8 +43,6 @@ #include #include #include -#include -#include #include #include @@ -5924,34 +5922,34 @@ error: return NULL; } -__isl_give isl_basic_map *isl_basic_map_empty(__isl_take isl_space *dim) +__isl_give isl_basic_map *isl_basic_map_empty(__isl_take isl_space *space) { struct isl_basic_map *bmap; - bmap = isl_basic_map_alloc_space(dim, 0, 1, 0); + bmap = isl_basic_map_alloc_space(space, 0, 1, 0); bmap = isl_basic_map_set_to_empty(bmap); return bmap; } -__isl_give isl_basic_set *isl_basic_set_empty(__isl_take isl_space *dim) +__isl_give isl_basic_set *isl_basic_set_empty(__isl_take isl_space *space) { struct isl_basic_set *bset; - bset = isl_basic_set_alloc_space(dim, 0, 1, 0); + bset = isl_basic_set_alloc_space(space, 0, 1, 0); bset = isl_basic_set_set_to_empty(bset); return bset; } -__isl_give isl_basic_map *isl_basic_map_universe(__isl_take isl_space *dim) +__isl_give isl_basic_map *isl_basic_map_universe(__isl_take isl_space *space) { struct isl_basic_map *bmap; - bmap = isl_basic_map_alloc_space(dim, 0, 0, 0); + bmap = isl_basic_map_alloc_space(space, 0, 0, 0); bmap = isl_basic_map_finalize(bmap); return bmap; } -__isl_give isl_basic_set *isl_basic_set_universe(__isl_take isl_space *dim) +__isl_give isl_basic_set *isl_basic_set_universe(__isl_take isl_space *space) { struct isl_basic_set *bset; - bset = isl_basic_set_alloc_space(dim, 0, 0, 0); + bset = isl_basic_set_alloc_space(space, 0, 0, 0); bset = isl_basic_set_finalize(bset); return bset; } @@ -5991,33 +5989,33 @@ __isl_give isl_set *isl_set_nat_universe(__isl_take isl_space *dim) return isl_map_nat_universe(dim); } -__isl_give isl_map *isl_map_empty(__isl_take isl_space *dim) +__isl_give isl_map *isl_map_empty(__isl_take isl_space *space) { - return isl_map_alloc_space(dim, 0, ISL_MAP_DISJOINT); + return isl_map_alloc_space(space, 0, ISL_MAP_DISJOINT); } -__isl_give isl_set *isl_set_empty(__isl_take isl_space *dim) +__isl_give isl_set *isl_set_empty(__isl_take isl_space *space) { - return isl_set_alloc_space(dim, 0, ISL_MAP_DISJOINT); + return isl_set_alloc_space(space, 0, ISL_MAP_DISJOINT); } -__isl_give isl_map *isl_map_universe(__isl_take isl_space *dim) +__isl_give isl_map *isl_map_universe(__isl_take isl_space *space) { struct isl_map *map; - if (!dim) + if (!space) return NULL; - map = isl_map_alloc_space(isl_space_copy(dim), 1, ISL_MAP_DISJOINT); - map = isl_map_add_basic_map(map, isl_basic_map_universe(dim)); + map = isl_map_alloc_space(isl_space_copy(space), 1, ISL_MAP_DISJOINT); + map = isl_map_add_basic_map(map, isl_basic_map_universe(space)); return map; } -__isl_give isl_set *isl_set_universe(__isl_take isl_space *dim) +__isl_give isl_set *isl_set_universe(__isl_take isl_space *space) { struct isl_set *set; - if (!dim) + if (!space) return NULL; - set = isl_set_alloc_space(isl_space_copy(dim), 1, ISL_MAP_DISJOINT); - set = isl_set_add_basic_set(set, isl_basic_set_universe(dim)); + set = isl_set_alloc_space(isl_space_copy(space), 1, ISL_MAP_DISJOINT); + set = isl_set_add_basic_set(set, isl_basic_set_universe(space)); return set; } @@ -6867,59 +6865,22 @@ static __isl_give isl_set *isl_basic_set_lexmin_compute_divs( return isl_basic_set_lexopt(bset, ISL_OPT_QE); } -/* Extract the first and only affine expression from list - * and then add it to *pwaff with the given dom. - * This domain is known to be disjoint from other domains - * because of the way isl_basic_map_foreach_lexmax works. - */ -static isl_stat update_dim_opt(__isl_take isl_basic_set *dom, - __isl_take isl_aff_list *list, void *user) -{ - isl_ctx *ctx = isl_basic_set_get_ctx(dom); - isl_aff *aff; - isl_pw_aff **pwaff = user; - isl_pw_aff *pwaff_i; - - if (!list) - goto error; - if (isl_aff_list_n_aff(list) != 1) - isl_die(ctx, isl_error_internal, - "expecting single element list", goto error); - - aff = isl_aff_list_get_aff(list, 0); - pwaff_i = isl_pw_aff_alloc(isl_set_from_basic_set(dom), aff); - - *pwaff = isl_pw_aff_add_disjoint(*pwaff, pwaff_i); - - isl_aff_list_free(list); - - return isl_stat_ok; -error: - isl_basic_set_free(dom); - isl_aff_list_free(list); - return isl_stat_error; -} - /* Given a basic map with one output dimension, compute the minimum or * maximum of that dimension as an isl_pw_aff. * - * The isl_pw_aff is constructed by having isl_basic_map_foreach_lexopt - * call update_dim_opt on each leaf of the result. + * Compute the optimum as a lexicographic optimum over the single + * output dimension and extract the single isl_pw_aff from the result. */ static __isl_give isl_pw_aff *basic_map_dim_opt(__isl_keep isl_basic_map *bmap, int max) { - isl_space *dim = isl_basic_map_get_space(bmap); + isl_pw_multi_aff *pma; isl_pw_aff *pwaff; - isl_stat r; - dim = isl_space_from_domain(isl_space_domain(dim)); - dim = isl_space_add_dims(dim, isl_dim_out, 1); - pwaff = isl_pw_aff_empty(dim); - - r = isl_basic_map_foreach_lexopt(bmap, max, &update_dim_opt, &pwaff); - if (r < 0) - return isl_pw_aff_free(pwaff); + bmap = isl_basic_map_copy(bmap); + pma = isl_basic_map_lexopt_pw_multi_aff(bmap, max ? ISL_OPT_MAX : 0); + pwaff = isl_pw_multi_aff_get_pw_aff(pma, 0); + isl_pw_multi_aff_free(pma); return pwaff; } @@ -9407,12 +9368,6 @@ __isl_give isl_val *isl_set_plain_get_val_if_fixed(__isl_keep isl_set *set, return isl_map_plain_get_val_if_fixed(set, type, pos); } -isl_bool isl_set_plain_is_fixed(__isl_keep isl_set *set, - enum isl_dim_type type, unsigned pos, isl_int *val) -{ - return isl_map_plain_is_fixed(set, type, pos, val); -} - /* Check if dimension dim has fixed value and if so and if val is not NULL, * then return this fixed value in *val. */ diff --git a/polly/lib/External/isl/isl_map_private.h b/polly/lib/External/isl/isl_map_private.h index ba2937efe89c..cfe7272929bf 100644 --- a/polly/lib/External/isl/isl_map_private.h +++ b/polly/lib/External/isl/isl_map_private.h @@ -476,11 +476,6 @@ isl_bool isl_map_align_params_map_map_and_test(__isl_keep isl_map *map1, __isl_keep isl_map *map2, isl_bool (*fn)(__isl_keep isl_map *map1, __isl_keep isl_map *map2)); -isl_stat isl_basic_map_foreach_lexopt(__isl_keep isl_basic_map *bmap, int max, - isl_stat (*fn)(__isl_take isl_basic_set *dom, - __isl_take isl_aff_list *list, void *user), - void *user); - __isl_give isl_set *isl_set_substitute(__isl_take isl_set *set, enum isl_dim_type type, unsigned pos, __isl_keep isl_aff *subs); @@ -536,8 +531,6 @@ __isl_give isl_basic_map *isl_basic_map_shift_div( __isl_give isl_basic_map_list *isl_map_get_basic_map_list( __isl_keep isl_map *map); -__isl_give isl_map *isl_map_fixed_power(__isl_take isl_map *map, isl_int exp); - int isl_basic_set_count_upto(__isl_keep isl_basic_set *bset, isl_int max, isl_int *count); int isl_set_count_upto(__isl_keep isl_set *set, isl_int max, isl_int *count); diff --git a/polly/lib/External/isl/isl_mat.c b/polly/lib/External/isl/isl_mat.c index 0e9666c8e5df..ab117f0cb85c 100644 --- a/polly/lib/External/isl/isl_mat.c +++ b/polly/lib/External/isl/isl_mat.c @@ -1,11 +1,15 @@ /* * Copyright 2008-2009 Katholieke Universiteit Leuven + * Copyright 2010 INRIA Saclay * Copyright 2014 Ecole Normale Superieure + * Copyright 2017 Sven Verdoolaege * * Use of this software is governed by the MIT license * * Written by Sven Verdoolaege, K.U.Leuven, Departement * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium + * and INRIA Saclay - Ile-de-France, Parc Club Orsay Universite, + * ZAC des vignes, 4 rue Jacques Monod, 91893 Orsay, France * and Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France */ @@ -17,7 +21,6 @@ #include #include #include -#include isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat) { @@ -283,6 +286,34 @@ static isl_stat check_row(__isl_keep isl_mat *mat, int row) return isl_stat_ok; } +/* Check that there are "n" columns starting at position "first" in "mat". + */ +static isl_stat check_col_range(__isl_keep isl_mat *mat, unsigned first, + unsigned n) +{ + if (!mat) + return isl_stat_error; + if (first + n > mat->n_col || first + n < first) + isl_die(isl_mat_get_ctx(mat), isl_error_invalid, + "column position or range out of bounds", + return isl_stat_error); + return isl_stat_ok; +} + +/* Check that there are "n" rows starting at position "first" in "mat". + */ +static isl_stat check_row_range(__isl_keep isl_mat *mat, unsigned first, + unsigned n) +{ + if (!mat) + return isl_stat_error; + if (first + n > mat->n_row || first + n < first) + isl_die(isl_mat_get_ctx(mat), isl_error_invalid, + "row position or range out of bounds", + return isl_stat_error); + return isl_stat_ok; +} + int isl_mat_get_element(__isl_keep isl_mat *mat, int row, int col, isl_int *v) { if (check_row(mat, row) < 0) @@ -786,9 +817,51 @@ __isl_give isl_mat *isl_mat_lexnonneg_rows(__isl_take isl_mat *mat) return mat; } -struct isl_mat *isl_mat_right_kernel(struct isl_mat *mat) +/* Given a matrix "H" is column echelon form, what is the first + * zero column? That is how many initial columns are non-zero? + * Start looking at column "first_col" and only consider + * the columns to be of size "n_row". + * "H" is assumed to be non-NULL. + * + * Since "H" is in column echelon form, the first non-zero entry + * in a column is always in a later position compared to the previous column. + */ +static int hermite_first_zero_col(__isl_keep isl_mat *H, int first_col, + int n_row) { - int i, rank; + int row, col; + + for (col = first_col, row = 0; col < H->n_col; ++col) { + for (; row < n_row; ++row) + if (!isl_int_is_zero(H->row[row][col])) + break; + if (row == n_row) + return col; + } + + return H->n_col; +} + +/* Return the rank of "mat", or -1 in case of error. + */ +int isl_mat_rank(__isl_keep isl_mat *mat) +{ + int rank; + isl_mat *H; + + H = isl_mat_left_hermite(isl_mat_copy(mat), 0, NULL, NULL); + if (!H) + return -1; + + rank = hermite_first_zero_col(H, 0, H->n_row); + isl_mat_free(H); + + return rank; +} + +__isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat) +{ + int rank; struct isl_mat *U = NULL; struct isl_mat *K; @@ -796,12 +869,7 @@ struct isl_mat *isl_mat_right_kernel(struct isl_mat *mat) if (!mat || !U) goto error; - for (i = 0, rank = 0; rank < mat->n_col; ++rank) { - while (i < mat->n_row && isl_int_is_zero(mat->row[i][rank])) - ++i; - if (i >= mat->n_row) - break; - } + rank = hermite_first_zero_col(mat, 0, mat->n_row); K = isl_mat_alloc(U->ctx, U->n_row, U->n_col - rank); if (!K) goto error; @@ -1161,17 +1229,13 @@ __isl_give isl_mat *isl_mat_swap_cols(__isl_take isl_mat *mat, int r; mat = isl_mat_cow(mat); - if (!mat) - return NULL; - isl_assert(mat->ctx, i < mat->n_col, goto error); - isl_assert(mat->ctx, j < mat->n_col, goto error); + if (check_col_range(mat, i, 1) < 0 || + check_col_range(mat, j, 1) < 0) + return isl_mat_free(mat); for (r = 0; r < mat->n_row; ++r) isl_int_swap(mat->row[r][i], mat->row[r][j]); return mat; -error: - isl_mat_free(mat); - return NULL; } __isl_give isl_mat *isl_mat_swap_rows(__isl_take isl_mat *mat, @@ -1182,8 +1246,10 @@ __isl_give isl_mat *isl_mat_swap_rows(__isl_take isl_mat *mat, if (!mat) return NULL; mat = isl_mat_cow(mat); - if (!mat) - return NULL; + if (check_row_range(mat, i, 1) < 0 || + check_row_range(mat, j, 1) < 0) + return isl_mat_free(mat); + t = mat->row[i]; mat->row[i] = mat->row[j]; mat->row[j] = t; @@ -1438,8 +1504,8 @@ __isl_give isl_mat *isl_mat_drop_cols(__isl_take isl_mat *mat, return mat; mat = isl_mat_cow(mat); - if (!mat) - return NULL; + if (check_col_range(mat, col, n) < 0) + return isl_mat_free(mat); if (col != mat->n_col-n) { for (r = 0; r < mat->n_row; ++r) @@ -1456,8 +1522,8 @@ __isl_give isl_mat *isl_mat_drop_rows(__isl_take isl_mat *mat, int r; mat = isl_mat_cow(mat); - if (!mat) - return NULL; + if (check_row_range(mat, row, n) < 0) + return isl_mat_free(mat); for (r = row; r+n < mat->n_row; ++r) mat->row[r] = mat->row[r+n]; @@ -1471,8 +1537,8 @@ __isl_give isl_mat *isl_mat_insert_cols(__isl_take isl_mat *mat, { isl_mat *ext; - if (!mat) - return NULL; + if (check_col_range(mat, col, 0) < 0) + return isl_mat_free(mat); if (n == 0) return mat; @@ -1521,8 +1587,8 @@ __isl_give isl_mat *isl_mat_insert_rows(__isl_take isl_mat *mat, { isl_mat *ext; - if (!mat) - return NULL; + if (check_row_range(mat, row, 0) < 0) + return isl_mat_free(mat); if (n == 0) return mat; @@ -1952,3 +2018,82 @@ int isl_mat_initial_non_zero_cols(__isl_keep isl_mat *mat) return i; } + +/* Return a basis for the space spanned by the rows of "mat". + * Any basis will do, so simply perform Gaussian elimination and + * remove the empty rows. + */ +__isl_give isl_mat *isl_mat_row_basis(__isl_take isl_mat *mat) +{ + return isl_mat_reverse_gauss(mat); +} + +/* Return rows that extend a basis of "mat1" to one + * that covers both "mat1" and "mat2". + * The Hermite normal form of the concatenation of the two matrices is + * + * [ Q1 ] + * [ M1 ] = [ H1 0 0 ] [ Q2 ] + * [ M2 ] = [ H2 H3 0 ] [ Q3 ] + * + * The number of columns in H1 and H3 determine the number of rows + * in Q1 and Q2. Q1 is a basis for M1, while Q2 extends this basis + * to also cover M2. + */ +__isl_give isl_mat *isl_mat_row_basis_extension( + __isl_take isl_mat *mat1, __isl_take isl_mat *mat2) +{ + int n_row; + int r1, r, n1; + isl_mat *H, *Q; + + n1 = isl_mat_rows(mat1); + H = isl_mat_concat(mat1, mat2); + H = isl_mat_left_hermite(H, 0, NULL, &Q); + if (!H || !Q) + goto error; + + r1 = hermite_first_zero_col(H, 0, n1); + r = hermite_first_zero_col(H, r1, H->n_row); + n_row = isl_mat_rows(Q); + Q = isl_mat_drop_rows(Q, r, n_row - r); + Q = isl_mat_drop_rows(Q, 0, r1); + + isl_mat_free(H); + return Q; +error: + isl_mat_free(H); + isl_mat_free(Q); + return NULL; +} + +/* Are the rows of "mat1" linearly independent of those of "mat2"? + * That is, is there no linear dependence among the combined rows + * that is not already present in either "mat1" or "mat2"? + * In other words, is the rank of "mat1" and "mat2" combined equal + * to the sum of the ranks of "mat1" and "mat2"? + */ +isl_bool isl_mat_has_linearly_independent_rows(__isl_keep isl_mat *mat1, + __isl_keep isl_mat *mat2) +{ + int r1, r2, r; + isl_mat *mat; + + r1 = isl_mat_rank(mat1); + if (r1 < 0) + return isl_bool_error; + if (r1 == 0) + return isl_bool_true; + r2 = isl_mat_rank(mat2); + if (r2 < 0) + return isl_bool_error; + if (r2 == 0) + return isl_bool_true; + + mat = isl_mat_concat(isl_mat_copy(mat1), isl_mat_copy(mat2)); + r = isl_mat_rank(mat); + isl_mat_free(mat); + if (r < 0) + return isl_bool_error; + return r == r1 + r2; +} diff --git a/polly/lib/External/isl/isl_mat_private.h b/polly/lib/External/isl/isl_mat_private.h index 7733d81bb161..1a3f69ea4785 100644 --- a/polly/lib/External/isl/isl_mat_private.h +++ b/polly/lib/External/isl/isl_mat_private.h @@ -23,6 +23,8 @@ struct isl_mat { uint32_t isl_mat_get_hash(__isl_keep isl_mat *mat); __isl_give isl_mat *isl_mat_zero(isl_ctx *ctx, unsigned n_row, unsigned n_col); +__isl_give isl_mat *isl_mat_dup(__isl_keep isl_mat *mat); +__isl_give isl_mat *isl_mat_cow(__isl_take isl_mat *mat); __isl_give isl_mat *isl_mat_sub_alloc(__isl_keep isl_mat *mat, unsigned first_row, unsigned n_row, unsigned first_col, unsigned n_col); __isl_give isl_mat *isl_mat_sub_alloc6(isl_ctx *ctx, isl_int **row, diff --git a/polly/lib/External/isl/isl_morph.c b/polly/lib/External/isl/isl_morph.c index 9b615f126a55..563f579a2a94 100644 --- a/polly/lib/External/isl/isl_morph.c +++ b/polly/lib/External/isl/isl_morph.c @@ -543,7 +543,7 @@ __isl_give isl_morph *isl_basic_set_parameter_compression( /* Add stride constraints to "bset" based on the inverse mapping * that was plugged in. In particular, if morph maps x' to x, - * the the constraints of the original input + * the constraints of the original input * * A x' + b >= 0 * diff --git a/polly/lib/External/isl/isl_multi_dims.c b/polly/lib/External/isl/isl_multi_dims.c new file mode 100644 index 000000000000..93e98ad0f89f --- /dev/null +++ b/polly/lib/External/isl/isl_multi_dims.c @@ -0,0 +1,105 @@ +/* + * Copyright 2011 Sven Verdoolaege + * Copyright 2012-2013 Ecole Normale Superieure + * + * Use of this software is governed by the MIT license + * + * Written by Sven Verdoolaege, + * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France + */ + +#include + +#include + +/* Check whether "multi" has non-zero coefficients for any dimension + * in the given range or if any of these dimensions appear + * with non-zero coefficients in any of the integer divisions involved. + */ +isl_bool FN(MULTI(BASE),involves_dims)(__isl_keep MULTI(BASE) *multi, + enum isl_dim_type type, unsigned first, unsigned n) +{ + int i; + + if (!multi) + return isl_bool_error; + if (multi->n == 0 || n == 0) + return isl_bool_false; + + for (i = 0; i < multi->n; ++i) { + isl_bool involves; + + involves = FN(EL,involves_dims)(multi->p[i], type, first, n); + if (involves < 0 || involves) + return involves; + } + + return isl_bool_false; +} + +__isl_give MULTI(BASE) *FN(MULTI(BASE),insert_dims)( + __isl_take MULTI(BASE) *multi, + enum isl_dim_type type, unsigned first, unsigned n) +{ + int i; + + if (!multi) + return NULL; + if (type == isl_dim_out) + isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, + "cannot insert output/set dimensions", + return FN(MULTI(BASE),free)(multi)); + if (n == 0 && !isl_space_is_named_or_nested(multi->space, type)) + return multi; + + multi = FN(MULTI(BASE),cow)(multi); + if (!multi) + return NULL; + + multi->space = isl_space_insert_dims(multi->space, type, first, n); + if (!multi->space) + return FN(MULTI(BASE),free)(multi); + + for (i = 0; i < multi->n; ++i) { + multi->p[i] = FN(EL,insert_dims)(multi->p[i], type, first, n); + if (!multi->p[i]) + return FN(MULTI(BASE),free)(multi); + } + + return multi; +} + +__isl_give MULTI(BASE) *FN(MULTI(BASE),add_dims)(__isl_take MULTI(BASE) *multi, + enum isl_dim_type type, unsigned n) +{ + unsigned pos; + + pos = FN(MULTI(BASE),dim)(multi, type); + + return FN(MULTI(BASE),insert_dims)(multi, type, pos, n); +} + +/* Project the domain of "multi" onto its parameter space. + * "multi" may not involve any of the domain dimensions. + */ +__isl_give MULTI(BASE) *FN(MULTI(BASE),project_domain_on_params)( + __isl_take MULTI(BASE) *multi) +{ + unsigned n; + isl_bool involves; + isl_space *space; + + n = FN(MULTI(BASE),dim)(multi, isl_dim_in); + involves = FN(MULTI(BASE),involves_dims)(multi, isl_dim_in, 0, n); + if (involves < 0) + return FN(MULTI(BASE),free)(multi); + if (involves) + isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, + "expression involves some of the domain dimensions", + return FN(MULTI(BASE),free)(multi)); + multi = FN(MULTI(BASE),drop_dims)(multi, isl_dim_in, 0, n); + space = FN(MULTI(BASE),get_domain_space)(multi); + space = isl_space_params(space); + multi = FN(MULTI(BASE),reset_domain_space)(multi, space); + return multi; +} diff --git a/polly/lib/External/isl/isl_multi_templ.c b/polly/lib/External/isl/isl_multi_templ.c index f2f2618117f3..d785030ef64a 100644 --- a/polly/lib/External/isl/isl_multi_templ.c +++ b/polly/lib/External/isl/isl_multi_templ.c @@ -129,75 +129,6 @@ __isl_null MULTI(BASE) *FN(MULTI(BASE),free)(__isl_take MULTI(BASE) *multi) return NULL; } -#ifndef NO_DIMS -/* Check whether "multi" has non-zero coefficients for any dimension - * in the given range or if any of these dimensions appear - * with non-zero coefficients in any of the integer divisions involved. - */ -isl_bool FN(MULTI(BASE),involves_dims)(__isl_keep MULTI(BASE) *multi, - enum isl_dim_type type, unsigned first, unsigned n) -{ - int i; - - if (!multi) - return isl_bool_error; - if (multi->n == 0 || n == 0) - return isl_bool_false; - - for (i = 0; i < multi->n; ++i) { - isl_bool involves; - - involves = FN(EL,involves_dims)(multi->p[i], type, first, n); - if (involves < 0 || involves) - return involves; - } - - return isl_bool_false; -} - -__isl_give MULTI(BASE) *FN(MULTI(BASE),insert_dims)( - __isl_take MULTI(BASE) *multi, - enum isl_dim_type type, unsigned first, unsigned n) -{ - int i; - - if (!multi) - return NULL; - if (type == isl_dim_out) - isl_die(FN(MULTI(BASE),get_ctx)(multi), isl_error_invalid, - "cannot insert output/set dimensions", - return FN(MULTI(BASE),free)(multi)); - if (n == 0 && !isl_space_is_named_or_nested(multi->space, type)) - return multi; - - multi = FN(MULTI(BASE),cow)(multi); - if (!multi) - return NULL; - - multi->space = isl_space_insert_dims(multi->space, type, first, n); - if (!multi->space) - return FN(MULTI(BASE),free)(multi); - - for (i = 0; i < multi->n; ++i) { - multi->p[i] = FN(EL,insert_dims)(multi->p[i], type, first, n); - if (!multi->p[i]) - return FN(MULTI(BASE),free)(multi); - } - - return multi; -} - -__isl_give MULTI(BASE) *FN(MULTI(BASE),add_dims)(__isl_take MULTI(BASE) *multi, - enum isl_dim_type type, unsigned n) -{ - unsigned pos; - - pos = FN(MULTI(BASE),dim)(multi, type); - - return FN(MULTI(BASE),insert_dims)(multi, type, pos, n); -} -#endif - unsigned FN(MULTI(BASE),dim)(__isl_keep MULTI(BASE) *multi, enum isl_dim_type type) { @@ -333,7 +264,7 @@ error: /* Reset the space of "multi". This function is called from isl_pw_templ.c * and doesn't know if the space of an element object is represented * directly or through its domain. It therefore passes along both, - * which we pass along to the element function since we don't how + * which we pass along to the element function since we don't know how * that is represented either. */ __isl_give MULTI(BASE) *FN(MULTI(BASE),reset_space_and_domain)( @@ -1326,7 +1257,7 @@ __isl_give MULTI(BASE) *FN(MULTI(BASE),mod_multi_val)( multi = FN(MULTI(BASE),cow)(multi); if (!multi) - return NULL; + goto error; for (i = 0; i < multi->n; ++i) { isl_val *v; diff --git a/polly/lib/External/isl/isl_obj.c b/polly/lib/External/isl/isl_obj.c index e12035fcf8dc..da593d3ffc1b 100644 --- a/polly/lib/External/isl/isl_obj.c +++ b/polly/lib/External/isl/isl_obj.c @@ -13,6 +13,7 @@ * B.P. 105 - 78153 Le Chesnay, France */ +#include #include #include #include diff --git a/polly/lib/External/isl/isl_output.c b/polly/lib/External/isl/isl_output.c index 93442a952011..4888bae1ecb8 100644 --- a/polly/lib/External/isl/isl_output.c +++ b/polly/lib/External/isl/isl_output.c @@ -35,6 +35,7 @@ #include #include +#include static const char *s_to[2] = { " -> ", " \\to " }; static const char *s_and[2] = { " and ", " \\wedge " }; @@ -49,6 +50,7 @@ static const char *s_such_that[2] = { " : ", " \\mid " }; static const char *s_open_exists[2] = { "exists (", "\\exists \\, " }; static const char *s_close_exists[2] = { ")", "" }; static const char *s_div_prefix[2] = { "e", "\\alpha_" }; +static const char *s_mod[2] = { "mod", "\\bmod" }; static const char *s_param_prefix[2] = { "p", "p_" }; static const char *s_input_prefix[2] = { "i", "i_" }; static const char *s_output_prefix[2] = { "o", "o_" }; @@ -316,15 +318,20 @@ static __isl_give isl_printer *print_affine_of_len(__isl_keep isl_space *dim, return p; } -/* Print an affine expression "c" corresponding to a constraint in "bmap" +/* Print an affine expression "c" * to "p", with the variable names taken from "space" and * the integer division definitions taken from "div". */ -static __isl_give isl_printer *print_affine(__isl_keep isl_basic_map *bmap, - __isl_keep isl_space *space, __isl_keep isl_mat *div, - __isl_take isl_printer *p, isl_int *c) +static __isl_give isl_printer *print_affine(__isl_take isl_printer *p, + __isl_keep isl_space *space, __isl_keep isl_mat *div, isl_int *c) { - unsigned len = 1 + isl_basic_map_total_dim(bmap); + unsigned n_div; + unsigned len; + + if (!space || !div) + return isl_printer_free(p); + n_div = isl_mat_rows(div); + len = 1 + isl_space_dim(space, isl_dim_all) + n_div; return print_affine_of_len(space, div, p, c, len); } @@ -493,7 +500,7 @@ static const char *constraint_op(int sign, int strict, int latex) return s_ge[latex]; } -/* Print one side of a constraint "c" from "bmap" to "p", with +/* Print one side of a constraint "c" to "p", with * the variable names taken from "space" and the integer division definitions * taken from "div". * "last" is the position of the last non-zero coefficient. @@ -503,20 +510,13 @@ static const char *constraint_op(int sign, int strict, int latex) * c' op * * is printed. - * "first_constraint" is set if this is the first constraint - * in the conjunction. */ -static __isl_give isl_printer *print_half_constraint( - __isl_keep isl_basic_map *bmap, +static __isl_give isl_printer *print_half_constraint(__isl_take isl_printer *p, __isl_keep isl_space *space, __isl_keep isl_mat *div, - __isl_take isl_printer *p, isl_int *c, int last, const char *op, - int first_constraint, int latex) + isl_int *c, int last, const char *op, int latex) { - if (!first_constraint) - p = isl_printer_print_str(p, s_and[latex]); - isl_int_set_si(c[last], 0); - p = print_affine(bmap, space, div, p, c); + p = print_affine(p, space, div, c); p = isl_printer_print_str(p, " "); p = isl_printer_print_str(p, op); @@ -525,7 +525,7 @@ static __isl_give isl_printer *print_half_constraint( return p; } -/* Print a constraint "c" from "bmap" to "p", with the variable names +/* Print a constraint "c" to "p", with the variable names * taken from "space" and the integer division definitions taken from "div". * "last" is the position of the last non-zero coefficient, which is * moreover assumed to be negative. @@ -533,18 +533,11 @@ static __isl_give isl_printer *print_half_constraint( * the constraint is printed in the form * * -c[last] op c' - * - * "first_constraint" is set if this is the first constraint - * in the conjunction. */ -static __isl_give isl_printer *print_constraint(__isl_keep isl_basic_map *bmap, +static __isl_give isl_printer *print_constraint(__isl_take isl_printer *p, __isl_keep isl_space *space, __isl_keep isl_mat *div, - __isl_take isl_printer *p, - isl_int *c, int last, const char *op, int first_constraint, int latex) + isl_int *c, int last, const char *op, int latex) { - if (!first_constraint) - p = isl_printer_print_str(p, s_and[latex]); - isl_int_abs(c[last], c[last]); p = print_term(space, div, c[last], last, p, latex); @@ -554,11 +547,147 @@ static __isl_give isl_printer *print_constraint(__isl_keep isl_basic_map *bmap, p = isl_printer_print_str(p, " "); isl_int_set_si(c[last], 0); - p = print_affine(bmap, space, div, p, c); + p = print_affine(p, space, div, c); return p; } +/* Given an integer division + * + * floor(f/m) + * + * at position "pos" in "div", print the corresponding modulo expression + * + * (f) mod m + * + * to "p". The variable names are taken from "space", while any + * nested integer division definitions are taken from "div". + */ +static __isl_give isl_printer *print_mod(__isl_take isl_printer *p, + __isl_keep isl_space *space, __isl_keep isl_mat *div, int pos, + int latex) +{ + if (!p || !div) + return isl_printer_free(p); + + p = isl_printer_print_str(p, "("); + p = print_affine_of_len(space, div, p, + div->row[pos] + 1, div->n_col - 1); + p = isl_printer_print_str(p, ") "); + p = isl_printer_print_str(p, s_mod[latex]); + p = isl_printer_print_str(p, " "); + p = isl_printer_print_isl_int(p, div->row[pos][0]); + return p; +} + +/* Can the equality constraints "c" be printed as a modulo constraint? + * In particular, is of the form + * + * f - a m floor(g/m) = 0, + * + * with c = -a m the coefficient at position "pos"? + * Return the position of the corresponding integer division if so. + * Return the number of integer divisions if not. + * Return -1 on error. + * + * Modulo constraints are currently not printed in C format. + * Other than that, "pos" needs to correspond to an integer division + * with explicit representation and "c" needs to be a multiple + * of the denominator of the integer division. + */ +static int print_as_modulo_pos(__isl_keep isl_printer *p, + __isl_keep isl_space *space, __isl_keep isl_mat *div, unsigned pos, + isl_int c) +{ + isl_bool can_print; + unsigned n_div; + enum isl_dim_type type; + + if (!p) + return -1; + n_div = isl_mat_rows(div); + if (p->output_format == ISL_FORMAT_C) + return n_div; + type = pos2type(space, &pos); + if (type != isl_dim_div) + return n_div; + can_print = can_print_div_expr(p, div, pos); + if (can_print < 0) + return -1; + if (!can_print) + return n_div; + if (!isl_int_is_divisible_by(c, div->row[pos][0])) + return n_div; + return pos; +} + +/* Print equality constraint "c" to "p" as a modulo constraint, + * with the variable names taken from "space" and + * the integer division definitions taken from "div". + * "last" is the position of the last non-zero coefficient, which is + * moreover assumed to be negative and a multiple of the denominator + * of the corresponding integer division. "div_pos" is the corresponding + * position in the sequence of integer divisions. + * + * The equality is of the form + * + * f - a m floor(g/m) = 0. + * + * Print it as + * + * a (g mod m) = -f + a g + */ +static __isl_give isl_printer *print_eq_mod_constraint( + __isl_take isl_printer *p, __isl_keep isl_space *space, + __isl_keep isl_mat *div, unsigned div_pos, + isl_int *c, int last, int latex) +{ + isl_ctx *ctx; + int multiple; + + ctx = isl_printer_get_ctx(p); + isl_int_divexact(c[last], c[last], div->row[div_pos][0]); + isl_int_abs(c[last], c[last]); + multiple = !isl_int_is_one(c[last]); + if (multiple) { + p = isl_printer_print_isl_int(p, c[last]); + p = isl_printer_print_str(p, "*("); + } + p = print_mod(p, space, div, div_pos, latex); + if (multiple) + p = isl_printer_print_str(p, ")"); + p = isl_printer_print_str(p, " = "); + isl_seq_combine(c, ctx->negone, c, + c[last], div->row[div_pos] + 1, last); + isl_int_set_si(c[last], 0); + p = print_affine(p, space, div, c); + return p; +} + +/* Print equality constraint "c" to "p", with the variable names + * taken from "space" and the integer division definitions taken from "div". + * "last" is the position of the last non-zero coefficient, which is + * moreover assumed to be negative. + * + * If possible, print the equality constraint as a modulo constraint. + */ +static __isl_give isl_printer *print_eq_constraint(__isl_take isl_printer *p, + __isl_keep isl_space *space, __isl_keep isl_mat *div, isl_int *c, + int last, int latex) +{ + unsigned n_div; + int div_pos; + + n_div = isl_mat_rows(div); + div_pos = print_as_modulo_pos(p, space, div, last, c[last]); + if (div_pos < 0) + return isl_printer_free(p); + if (div_pos < n_div) + return print_eq_mod_constraint(p, space, div, div_pos, + c, last, latex); + return print_constraint(p, space, div, c, last, "=", latex); +} + /* Print the constraints of "bmap" to "p". * The names of the variables are taken from "space" and * the integer division definitions are taken from "div". @@ -632,12 +761,13 @@ static __isl_give isl_printer *print_constraints(__isl_keep isl_basic_map *bmap, p = isl_printer_print_str(p, "0 = 0"); continue; } + if (!first) + p = isl_printer_print_str(p, s_and[latex]); if (isl_int_is_neg(bmap->eq[i][l])) isl_seq_cpy(c->el, bmap->eq[i], 1 + total); else isl_seq_neg(c->el, bmap->eq[i], 1 + total); - p = print_constraint(bmap, space, div, p, c->el, l, - "=", first, latex); + p = print_eq_constraint(p, space, div, c->el, l, latex); first = 0; } for (i = 0; i < bmap->n_ineq; ++i) { @@ -657,6 +787,8 @@ static __isl_give isl_printer *print_constraints(__isl_keep isl_basic_map *bmap, if (is_div) continue; } + if (!first) + p = isl_printer_print_str(p, s_and[latex]); s = isl_int_sgn(bmap->ineq[i][l]); strict = !rational && isl_int_is_negone(bmap->ineq[i][0]); if (s < 0) @@ -667,13 +799,13 @@ static __isl_give isl_printer *print_constraints(__isl_keep isl_basic_map *bmap, isl_int_set_si(c->el[0], 0); if (!dump && next_is_opposite(bmap, i, l)) { op = constraint_op(-s, strict, latex); - p = print_half_constraint(bmap, space, div, p, c->el, l, - op, first, latex); + p = print_half_constraint(p, space, div, c->el, l, + op, latex); first = 1; } else { op = constraint_op(s, strict, latex); - p = print_constraint(bmap, space, div, p, c->el, l, - op, first, latex); + p = print_constraint(p, space, div, c->el, l, + op, latex); first = 0; } } @@ -787,6 +919,21 @@ static __isl_give isl_printer *open_exists(__isl_take isl_printer *p, return p; } +/* Remove the explicit representations of all local variables in "div". + */ +static __isl_give isl_mat *mark_all_unknown(__isl_take isl_mat *div) +{ + int i, n_div; + + if (!div) + return NULL; + + n_div = isl_mat_rows(div); + for (i = 0; i < n_div; ++i) + div = isl_mat_set_element_si(div, i, 0, 0); + return div; +} + /* Print the constraints of "bmap" to "p". * The names of the variables are taken from "space". * "latex" is set if the constraints should be printed in LaTeX format. @@ -808,7 +955,7 @@ static __isl_give isl_printer *print_disjunct(__isl_keep isl_basic_map *bmap, p = open_exists(p, space, div, latex); if (dump) - div = isl_mat_free(div); + div = mark_all_unknown(div); p = print_constraints(bmap, space, div, p, latex); isl_mat_free(div); @@ -928,7 +1075,7 @@ static __isl_give isl_printer *print_disjuncts_core(__isl_keep isl_map *map, int i; if (map->n == 0) - p = isl_printer_print_str(p, "1 = 0"); + p = isl_printer_print_str(p, "false"); for (i = 0; i < map->n; ++i) { if (i) p = isl_printer_print_str(p, s_or[latex]); @@ -1488,9 +1635,9 @@ __isl_give isl_printer *isl_printer_print_union_set(__isl_take isl_printer *p, goto error; if (p->output_format == ISL_FORMAT_ISL) - return isl_union_map_print_isl((isl_union_map *)uset, p); + return isl_union_map_print_isl(uset_to_umap(uset), p); if (p->output_format == ISL_FORMAT_LATEX) - return isl_union_map_print_latex((isl_union_map *)uset, p); + return isl_union_map_print_latex(uset_to_umap(uset), p); isl_die(p->ctx, isl_error_invalid, "invalid output format for isl_union_set", goto error); @@ -2985,7 +3132,7 @@ static __isl_give isl_printer *print_dim_mpa(__isl_take isl_printer *p, pa = mpa->p[pos]; if (pa->n == 0) - return isl_printer_print_str(p, "(0 : 1 = 0)"); + return isl_printer_print_str(p, "(0 : false)"); need_parens = pa->n != 1 || !isl_set_plain_is_universe(pa->p[0].set); if (need_parens) diff --git a/polly/lib/External/isl/isl_point.c b/polly/lib/External/isl/isl_point.c index 48534edd9c75..2d5b306b5773 100644 --- a/polly/lib/External/isl/isl_point.c +++ b/polly/lib/External/isl/isl_point.c @@ -9,7 +9,6 @@ #include #include #include -#include #include @@ -133,23 +132,6 @@ isl_bool isl_point_is_void(__isl_keep isl_point *pnt) return pnt->vec->size == 0; } -int isl_point_get_coordinate(__isl_keep isl_point *pnt, - enum isl_dim_type type, int pos, isl_int *v) -{ - if (!pnt || isl_point_is_void(pnt)) - return -1; - - if (pos < 0 || pos >= isl_space_dim(pnt->dim, type)) - isl_die(isl_point_get_ctx(pnt), isl_error_invalid, - "position out of bounds", return -1); - - if (type == isl_dim_set) - pos += isl_space_dim(pnt->dim, isl_dim_param); - isl_int_set(*v, pnt->vec->el[1 + pos]); - - return 0; -} - /* Return the value of coordinate "pos" of type "type" of "pnt". */ __isl_give isl_val *isl_point_get_coordinate_val(__isl_keep isl_point *pnt, @@ -177,30 +159,6 @@ __isl_give isl_val *isl_point_get_coordinate_val(__isl_keep isl_point *pnt, return isl_val_normalize(v); } -__isl_give isl_point *isl_point_set_coordinate(__isl_take isl_point *pnt, - enum isl_dim_type type, int pos, isl_int v) -{ - if (!pnt || isl_point_is_void(pnt)) - return pnt; - - pnt = isl_point_cow(pnt); - if (!pnt) - return NULL; - pnt->vec = isl_vec_cow(pnt->vec); - if (!pnt->vec) - goto error; - - if (type == isl_dim_set) - pos += isl_space_dim(pnt->dim, isl_dim_param); - - isl_int_set(pnt->vec->el[1 + pos], v); - - return pnt; -error: - isl_point_free(pnt); - return NULL; -} - /* Replace coordinate "pos" of type "type" of "pnt" by "v". */ __isl_give isl_point *isl_point_set_coordinate_val(__isl_take isl_point *pnt, diff --git a/polly/lib/External/isl/isl_polynomial.c b/polly/lib/External/isl/isl_polynomial.c index 2f4ba43d4f98..c7c0f62da417 100644 --- a/polly/lib/External/isl/isl_polynomial.c +++ b/polly/lib/External/isl/isl_polynomial.c @@ -28,7 +28,6 @@ #include #include #include -#include static unsigned pos(__isl_keep isl_space *dim, enum isl_dim_type type) { @@ -3856,13 +3855,6 @@ void isl_term_get_num(__isl_keep isl_term *term, isl_int *n) isl_int_set(*n, term->n); } -void isl_term_get_den(__isl_keep isl_term *term, isl_int *d) -{ - if (!term) - return; - isl_int_set(*d, term->d); -} - /* Return the coefficient of the term "term". */ __isl_give isl_val *isl_term_get_coefficient_val(__isl_keep isl_term *term) diff --git a/polly/lib/External/isl/isl_polynomial_private.h b/polly/lib/External/isl/isl_polynomial_private.h index b615b24e0b61..94f588392428 100644 --- a/polly/lib/External/isl/isl_polynomial_private.h +++ b/polly/lib/External/isl/isl_polynomial_private.h @@ -251,6 +251,9 @@ __isl_give isl_qpolynomial *isl_qpolynomial_mul_isl_int( __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul_isl_int( __isl_take isl_pw_qpolynomial *pwqp, isl_int v); +__isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_scale( + __isl_take isl_qpolynomial_fold *fold, isl_int v); + __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_mul_isl_int( __isl_take isl_qpolynomial_fold *fold, isl_int v); __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_mul_isl_int( diff --git a/polly/lib/External/isl/isl_pw_templ.c b/polly/lib/External/isl/isl_pw_templ.c index 124ff34da2ab..daf58fc876e7 100644 --- a/polly/lib/External/isl/isl_pw_templ.c +++ b/polly/lib/External/isl/isl_pw_templ.c @@ -100,6 +100,41 @@ error: return NULL; } +/* Does the space of "set" correspond to that of the domain of "el". + */ +static isl_bool FN(PW,compatible_domain)(__isl_keep EL *el, + __isl_keep isl_set *set) +{ + isl_bool ok; + isl_space *el_space, *set_space; + + if (!set || !el) + return isl_bool_error; + set_space = isl_set_get_space(set); + el_space = FN(EL,get_space)(el); + ok = isl_space_is_domain_internal(set_space, el_space); + isl_space_free(el_space); + isl_space_free(set_space); + return ok; +} + +/* Check that the space of "set" corresponds to that of the domain of "el". + */ +static isl_stat FN(PW,check_compatible_domain)(__isl_keep EL *el, + __isl_keep isl_set *set) +{ + isl_bool ok; + + ok = FN(PW,compatible_domain)(el, set); + if (ok < 0) + return isl_stat_error; + if (!ok) + isl_die(isl_set_get_ctx(set), isl_error_invalid, + "incompatible spaces", return isl_stat_error); + + return isl_stat_ok; +} + #ifdef HAS_TYPE __isl_give PW *FN(PW,alloc)(enum isl_fold type, __isl_take isl_set *set, __isl_take EL *el) @@ -1464,9 +1499,16 @@ __isl_give isl_val *FN(PW,min)(__isl_take PW *pw) } #endif +/* Return the space of "pw". + */ +__isl_keep isl_space *FN(PW,peek_space)(__isl_keep PW *pw) +{ + return pw ? pw->dim : NULL; +} + __isl_give isl_space *FN(PW,get_space)(__isl_keep PW *pw) { - return pw ? isl_space_copy(pw->dim) : NULL; + return isl_space_copy(FN(PW,peek_space)(pw)); } __isl_give isl_space *FN(PW,get_domain_space)(__isl_keep PW *pw) diff --git a/polly/lib/External/isl/isl_range.c b/polly/lib/External/isl/isl_range.c index d63ce58758a7..690d7b948f22 100644 --- a/polly/lib/External/isl/isl_range.c +++ b/polly/lib/External/isl/isl_range.c @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/polly/lib/External/isl/isl_reordering.c b/polly/lib/External/isl/isl_reordering.c index ca9c9737f76c..b65443e881c4 100644 --- a/polly/lib/External/isl/isl_reordering.c +++ b/polly/lib/External/isl/isl_reordering.c @@ -167,20 +167,20 @@ error: } __isl_give isl_reordering *isl_reordering_extend_space( - __isl_take isl_reordering *exp, __isl_take isl_space *dim) + __isl_take isl_reordering *exp, __isl_take isl_space *space) { isl_reordering *res; - if (!exp || !dim) + if (!exp || !space) goto error; res = isl_reordering_extend(isl_reordering_copy(exp), - isl_space_dim(dim, isl_dim_all) - exp->len); + isl_space_dim(space, isl_dim_all) - exp->len); res = isl_reordering_cow(res); if (!res) goto error; isl_space_free(res->dim); - res->dim = isl_space_replace(dim, isl_dim_param, exp->dim); + res->dim = isl_space_replace_params(space, exp->dim); isl_reordering_free(exp); @@ -190,7 +190,7 @@ __isl_give isl_reordering *isl_reordering_extend_space( return res; error: isl_reordering_free(exp); - isl_space_free(dim); + isl_space_free(space); return NULL; } diff --git a/polly/lib/External/isl/isl_reordering.h b/polly/lib/External/isl/isl_reordering.h index ac5b6facaba3..944d9f0a1c1d 100644 --- a/polly/lib/External/isl/isl_reordering.h +++ b/polly/lib/External/isl/isl_reordering.h @@ -24,7 +24,7 @@ __isl_give isl_reordering *isl_parameter_alignment_reordering( __isl_give isl_reordering *isl_reordering_copy(__isl_keep isl_reordering *exp); void *isl_reordering_free(__isl_take isl_reordering *exp); __isl_give isl_reordering *isl_reordering_extend_space( - __isl_take isl_reordering *exp, __isl_take isl_space *dim); + __isl_take isl_reordering *exp, __isl_take isl_space *space); __isl_give isl_reordering *isl_reordering_extend(__isl_take isl_reordering *exp, unsigned extra); diff --git a/polly/lib/External/isl/isl_schedule.c b/polly/lib/External/isl/isl_schedule.c index 90d8d5da1cd2..ddf083255015 100644 --- a/polly/lib/External/isl/isl_schedule.c +++ b/polly/lib/External/isl/isl_schedule.c @@ -12,16 +12,17 @@ */ #include +#include #include #include #include #include #include #include +#include #include #include #include -#include /* Return a schedule encapsulating the given schedule tree. * @@ -100,9 +101,6 @@ __isl_give isl_schedule *isl_schedule_copy(__isl_keep isl_schedule *sched) /* Return an isl_schedule that is equal to "schedule" and that has only * a single reference. - * - * We only need and support this function when the schedule is represented - * as a schedule tree. */ __isl_give isl_schedule *isl_schedule_cow(__isl_take isl_schedule *schedule) { @@ -115,10 +113,6 @@ __isl_give isl_schedule *isl_schedule_cow(__isl_take isl_schedule *schedule) return schedule; ctx = isl_schedule_get_ctx(schedule); - if (!schedule->root) - isl_die(ctx, isl_error_internal, - "only for schedule tree based schedules", - return isl_schedule_free(schedule)); schedule->ref--; tree = isl_schedule_tree_copy(schedule->root); return isl_schedule_from_schedule_tree(ctx, tree); @@ -132,7 +126,6 @@ __isl_null isl_schedule *isl_schedule_free(__isl_take isl_schedule *sched) if (--sched->ref > 0) return NULL; - isl_band_list_free(sched->band_forest); isl_schedule_tree_free(sched->root); isl_schedule_tree_free(sched->leaf); free(sched); @@ -202,10 +195,6 @@ __isl_give isl_space *isl_schedule_get_space( if (!schedule) return NULL; - if (!schedule->root) - isl_die(isl_schedule_get_ctx(schedule), isl_error_invalid, - "schedule tree representation not available", - return NULL); type = isl_schedule_tree_get_type(schedule->root); if (type != isl_schedule_node_domain) isl_die(isl_schedule_get_ctx(schedule), isl_error_internal, @@ -230,11 +219,6 @@ __isl_give isl_schedule_node *isl_schedule_get_root( if (!schedule) return NULL; - if (!schedule->root) - isl_die(isl_schedule_get_ctx(schedule), isl_error_invalid, - "schedule tree representation not available", - return NULL); - ctx = isl_schedule_get_ctx(schedule); tree = isl_schedule_tree_copy(schedule->root); schedule = isl_schedule_copy(schedule); @@ -242,76 +226,6 @@ __isl_give isl_schedule_node *isl_schedule_get_root( return isl_schedule_node_alloc(schedule, tree, ancestors, NULL); } -/* Set max_out to the maximal number of output dimensions over - * all maps. - */ -static isl_stat update_max_out(__isl_take isl_map *map, void *user) -{ - int *max_out = user; - int n_out = isl_map_dim(map, isl_dim_out); - - if (n_out > *max_out) - *max_out = n_out; - - isl_map_free(map); - return isl_stat_ok; -} - -/* Internal data structure for map_pad_range. - * - * "max_out" is the maximal schedule dimension. - * "res" collects the results. - */ -struct isl_pad_schedule_map_data { - int max_out; - isl_union_map *res; -}; - -/* Pad the range of the given map with zeros to data->max_out and - * then add the result to data->res. - */ -static isl_stat map_pad_range(__isl_take isl_map *map, void *user) -{ - struct isl_pad_schedule_map_data *data = user; - int i; - int n_out = isl_map_dim(map, isl_dim_out); - - map = isl_map_add_dims(map, isl_dim_out, data->max_out - n_out); - for (i = n_out; i < data->max_out; ++i) - map = isl_map_fix_si(map, isl_dim_out, i, 0); - - data->res = isl_union_map_add_map(data->res, map); - if (!data->res) - return isl_stat_error; - - return isl_stat_ok; -} - -/* Pad the ranges of the maps in the union map with zeros such they all have - * the same dimension. - */ -static __isl_give isl_union_map *pad_schedule_map( - __isl_take isl_union_map *umap) -{ - struct isl_pad_schedule_map_data data; - - if (!umap) - return NULL; - if (isl_union_map_n_map(umap) <= 1) - return umap; - - data.max_out = 0; - if (isl_union_map_foreach_map(umap, &update_max_out, &data.max_out) < 0) - return isl_union_map_free(umap); - - data.res = isl_union_map_empty(isl_union_map_get_space(umap)); - if (isl_union_map_foreach_map(umap, &map_pad_range, &data) < 0) - data.res = isl_union_map_free(data.res); - - isl_union_map_free(umap); - return data.res; -} - /* Return the domain of the root domain node of "schedule". */ __isl_give isl_union_set *isl_schedule_get_domain( @@ -319,10 +233,6 @@ __isl_give isl_union_set *isl_schedule_get_domain( { if (!schedule) return NULL; - if (!schedule->root) - isl_die(isl_schedule_get_ctx(schedule), isl_error_invalid, - "schedule tree representation not available", - return NULL); return isl_schedule_tree_domain_get_domain(schedule->root); } @@ -539,17 +449,10 @@ error: return NULL; } -/* Return an isl_union_map representation of the schedule. - * If we still have access to the schedule tree, then we return - * an isl_union_map corresponding to the subtree schedule of the child +/* Return an isl_union_map representation of the schedule. In particular, + * return an isl_union_map corresponding to the subtree schedule of the child * of the root domain node. That is, we do not intersect the domain * of the returned isl_union_map with the domain constraints. - * Otherwise, we must have removed it because we created a band forest. - * If so, we extract the isl_union_map from the forest. - * This reconstructed schedule map - * then needs to be padded with zeros to unify the schedule space - * since the result of isl_band_list_get_suffix_schedule may not have - * a unified schedule space. */ __isl_give isl_union_map *isl_schedule_get_map(__isl_keep isl_schedule *sched) { @@ -559,376 +462,17 @@ __isl_give isl_union_map *isl_schedule_get_map(__isl_keep isl_schedule *sched) if (!sched) return NULL; + type = isl_schedule_tree_get_type(sched->root); + if (type != isl_schedule_node_domain) + isl_die(isl_schedule_get_ctx(sched), isl_error_internal, + "root node not a domain node", return NULL); - if (sched->root) { - type = isl_schedule_tree_get_type(sched->root); - if (type != isl_schedule_node_domain) - isl_die(isl_schedule_get_ctx(sched), isl_error_internal, - "root node not a domain node", return NULL); - - node = isl_schedule_get_root(sched); - node = isl_schedule_node_child(node, 0); - umap = isl_schedule_node_get_subtree_schedule_union_map(node); - isl_schedule_node_free(node); - - return umap; - } - - umap = isl_band_list_get_suffix_schedule(sched->band_forest); - return pad_schedule_map(umap); -} - -static __isl_give isl_band_list *construct_band_list( - __isl_take isl_schedule_node *node, __isl_take isl_union_set *domain, - __isl_keep isl_band *parent); - -/* Construct an isl_band structure from the given schedule tree node, - * which may be either a band node or a leaf node. - * In the latter case, construct a zero-dimensional band. - * "domain" is the universe set of the domain elements that reach "node". - * "parent" is the parent isl_band of the isl_band constructed - * by this function. - * - * In case of a band node, we copy the properties (except tilability, - * which is implicit in an isl_band) to the isl_band. - * We assume that the band node is not zero-dimensional. - * If the child of the band node is not a leaf node, - * then we extract the children of the isl_band from this child. - */ -static __isl_give isl_band *construct_band(__isl_take isl_schedule_node *node, - __isl_take isl_union_set *domain, __isl_keep isl_band *parent) -{ - int i; - isl_ctx *ctx; - isl_band *band = NULL; - isl_multi_union_pw_aff *mupa; - - if (!node || !domain) - goto error; - - ctx = isl_schedule_node_get_ctx(node); - band = isl_band_alloc(ctx); - if (!band) - goto error; - - band->schedule = node->schedule; - band->parent = parent; - - if (isl_schedule_node_get_type(node) == isl_schedule_node_leaf) { - band->n = 0; - band->pma = isl_union_pw_multi_aff_from_domain(domain); - isl_schedule_node_free(node); - return band; - } - - band->n = isl_schedule_node_band_n_member(node); - if (band->n == 0) - isl_die(ctx, isl_error_unsupported, - "zero-dimensional band nodes not supported", - goto error); - band->coincident = isl_alloc_array(ctx, int, band->n); - if (band->n && !band->coincident) - goto error; - for (i = 0; i < band->n; ++i) - band->coincident[i] = - isl_schedule_node_band_member_get_coincident(node, i); - mupa = isl_schedule_node_band_get_partial_schedule(node); - band->pma = isl_union_pw_multi_aff_from_multi_union_pw_aff(mupa); - if (!band->pma) - goto error; - + node = isl_schedule_get_root(sched); node = isl_schedule_node_child(node, 0); - if (isl_schedule_node_get_type(node) == isl_schedule_node_leaf) { - isl_schedule_node_free(node); - isl_union_set_free(domain); - return band; - } - - band->children = construct_band_list(node, domain, band); - if (!band->children) - return isl_band_free(band); - - return band; -error: - isl_union_set_free(domain); - isl_schedule_node_free(node); - isl_band_free(band); - return NULL; -} - -/* Construct a list of isl_band structures from the children of "node". - * "node" itself is a sequence or set node, so that each of the child nodes - * is a filter node and the list returned by node_construct_band_list - * consists of a single element. - * "domain" is the universe set of the domain elements that reach "node". - * "parent" is the parent isl_band of the isl_band structures constructed - * by this function. - */ -static __isl_give isl_band_list *construct_band_list_from_children( - __isl_take isl_schedule_node *node, __isl_take isl_union_set *domain, - __isl_keep isl_band *parent) -{ - int i, n; - isl_ctx *ctx; - isl_band_list *list; - - n = isl_schedule_node_n_children(node); - - ctx = isl_schedule_node_get_ctx(node); - list = isl_band_list_alloc(ctx, 0); - for (i = 0; i < n; ++i) { - isl_schedule_node *child; - isl_band_list *list_i; - - child = isl_schedule_node_get_child(node, i); - list_i = construct_band_list(child, isl_union_set_copy(domain), - parent); - list = isl_band_list_concat(list, list_i); - } - - isl_union_set_free(domain); + umap = isl_schedule_node_get_subtree_schedule_union_map(node); isl_schedule_node_free(node); - return list; -} - -/* Construct an isl_band structure from the given sequence node - * (or set node that is treated as a sequence node). - * A single-dimensional band is created with as schedule for each of - * filters of the children, the corresponding child position. - * "domain" is the universe set of the domain elements that reach "node". - * "parent" is the parent isl_band of the isl_band constructed - * by this function. - */ -static __isl_give isl_band_list *construct_band_list_sequence( - __isl_take isl_schedule_node *node, __isl_take isl_union_set *domain, - __isl_keep isl_band *parent) -{ - int i, n; - isl_ctx *ctx; - isl_band *band = NULL; - isl_space *space; - isl_union_pw_multi_aff *upma; - - if (!node || !domain) - goto error; - - ctx = isl_schedule_node_get_ctx(node); - band = isl_band_alloc(ctx); - if (!band) - goto error; - - band->schedule = node->schedule; - band->parent = parent; - band->n = 1; - band->coincident = isl_calloc_array(ctx, int, band->n); - if (!band->coincident) - goto error; - - n = isl_schedule_node_n_children(node); - space = isl_union_set_get_space(domain); - upma = isl_union_pw_multi_aff_empty(isl_space_copy(space)); - - space = isl_space_set_from_params(space); - space = isl_space_add_dims(space, isl_dim_set, 1); - - for (i = 0; i < n; ++i) { - isl_schedule_node *child; - isl_union_set *filter; - isl_val *v; - isl_val_list *vl; - isl_multi_val *mv; - isl_union_pw_multi_aff *upma_i; - - child = isl_schedule_node_get_child(node, i); - filter = isl_schedule_node_filter_get_filter(child); - isl_schedule_node_free(child); - filter = isl_union_set_intersect(filter, - isl_union_set_copy(domain)); - v = isl_val_int_from_si(ctx, i); - vl = isl_val_list_from_val(v); - mv = isl_multi_val_from_val_list(isl_space_copy(space), vl); - upma_i = isl_union_pw_multi_aff_multi_val_on_domain(filter, mv); - upma = isl_union_pw_multi_aff_union_add(upma, upma_i); - } - - isl_space_free(space); - - band->pma = upma; - if (!band->pma) - goto error; - - band->children = construct_band_list_from_children(node, domain, band); - if (!band->children) - band = isl_band_free(band); - return isl_band_list_from_band(band); -error: - isl_union_set_free(domain); - isl_schedule_node_free(node); - isl_band_free(band); - return NULL; -} - -/* Construct a list of isl_band structures from "node" depending - * on the type of "node". - * "domain" is the universe set of the domain elements that reach "node". - * "parent" is the parent isl_band of the isl_band structures constructed - * by this function. - * - * If schedule_separate_components is set then set nodes are treated - * as sequence nodes. Otherwise, we directly extract an (implicitly - * parallel) list of isl_band structures. - * - * If "node" is a filter, then "domain" is updated by the filter. - */ -static __isl_give isl_band_list *construct_band_list( - __isl_take isl_schedule_node *node, __isl_take isl_union_set *domain, - __isl_keep isl_band *parent) -{ - enum isl_schedule_node_type type; - isl_ctx *ctx; - isl_band *band; - isl_band_list *list; - isl_union_set *filter; - - if (!node || !domain) - goto error; - - type = isl_schedule_node_get_type(node); - switch (type) { - case isl_schedule_node_error: - goto error; - case isl_schedule_node_context: - isl_die(isl_schedule_node_get_ctx(node), isl_error_unsupported, - "context nodes not supported", goto error); - case isl_schedule_node_domain: - isl_die(isl_schedule_node_get_ctx(node), isl_error_invalid, - "internal domain nodes not allowed", goto error); - case isl_schedule_node_expansion: - isl_die(isl_schedule_node_get_ctx(node), isl_error_unsupported, - "expansion nodes not supported", goto error); - case isl_schedule_node_extension: - isl_die(isl_schedule_node_get_ctx(node), isl_error_unsupported, - "extension nodes not supported", goto error); - case isl_schedule_node_filter: - filter = isl_schedule_node_filter_get_filter(node); - domain = isl_union_set_intersect(domain, filter); - node = isl_schedule_node_child(node, 0); - return construct_band_list(node, domain, parent); - case isl_schedule_node_guard: - isl_die(isl_schedule_node_get_ctx(node), isl_error_unsupported, - "guard nodes not supported", goto error); - case isl_schedule_node_mark: - isl_die(isl_schedule_node_get_ctx(node), isl_error_unsupported, - "mark nodes not supported", goto error); - case isl_schedule_node_set: - ctx = isl_schedule_node_get_ctx(node); - if (isl_options_get_schedule_separate_components(ctx)) - return construct_band_list_sequence(node, domain, - parent); - else - return construct_band_list_from_children(node, domain, - parent); - case isl_schedule_node_sequence: - return construct_band_list_sequence(node, domain, parent); - case isl_schedule_node_leaf: - case isl_schedule_node_band: - band = construct_band(node, domain, parent); - list = isl_band_list_from_band(band); - break; - } - - return list; -error: - isl_union_set_free(domain); - isl_schedule_node_free(node); - return NULL; -} - -/* Return the roots of a band forest representation of the schedule. - * The band forest is constructed from the schedule tree, - * but once such a band forest is - * constructed, we forget about the original schedule tree since - * the user may modify the schedule through the band forest. - */ -__isl_give isl_band_list *isl_schedule_get_band_forest( - __isl_keep isl_schedule *schedule) -{ - isl_schedule_node *node; - isl_union_set *domain; - - if (!schedule) - return NULL; - if (schedule->root) { - node = isl_schedule_get_root(schedule); - domain = isl_schedule_node_domain_get_domain(node); - domain = isl_union_set_universe(domain); - node = isl_schedule_node_child(node, 0); - - schedule->band_forest = construct_band_list(node, domain, NULL); - schedule->root = isl_schedule_tree_free(schedule->root); - } - return isl_band_list_dup(schedule->band_forest); -} - -/* Call "fn" on each band in the schedule in depth-first post-order. - */ -int isl_schedule_foreach_band(__isl_keep isl_schedule *sched, - int (*fn)(__isl_keep isl_band *band, void *user), void *user) -{ - int r; - isl_band_list *forest; - - if (!sched) - return -1; - - forest = isl_schedule_get_band_forest(sched); - r = isl_band_list_foreach_band(forest, fn, user); - isl_band_list_free(forest); - - return r; -} - -static __isl_give isl_printer *print_band_list(__isl_take isl_printer *p, - __isl_keep isl_band_list *list); - -static __isl_give isl_printer *print_band(__isl_take isl_printer *p, - __isl_keep isl_band *band) -{ - isl_band_list *children; - - p = isl_printer_start_line(p); - p = isl_printer_print_union_pw_multi_aff(p, band->pma); - p = isl_printer_end_line(p); - - if (!isl_band_has_children(band)) - return p; - - children = isl_band_get_children(band); - - p = isl_printer_indent(p, 4); - p = print_band_list(p, children); - p = isl_printer_indent(p, -4); - - isl_band_list_free(children); - - return p; -} - -static __isl_give isl_printer *print_band_list(__isl_take isl_printer *p, - __isl_keep isl_band_list *list) -{ - int i, n; - - n = isl_band_list_n_band(list); - for (i = 0; i < n; ++i) { - isl_band *band; - band = isl_band_list_get_band(list, i); - p = print_band(p, band); - isl_band_free(band); - } - - return p; + return umap; } /* Insert a band node with partial schedule "partial" between the domain @@ -1125,29 +669,14 @@ __isl_give isl_schedule *isl_schedule_set( } /* Print "schedule" to "p". - * - * If "schedule" was created from a schedule tree, then we print - * the schedule tree representation. Otherwise, we print - * the band forest representation. */ __isl_give isl_printer *isl_printer_print_schedule(__isl_take isl_printer *p, __isl_keep isl_schedule *schedule) { - isl_band_list *forest; - if (!schedule) return isl_printer_free(p); - if (schedule->root) - return isl_printer_print_schedule_tree(p, schedule->root); - - forest = isl_schedule_get_band_forest(schedule); - - p = print_band_list(p, forest); - - isl_band_list_free(forest); - - return p; + return isl_printer_print_schedule_tree(p, schedule->root); } #undef BASE diff --git a/polly/lib/External/isl/isl_schedule_band.c b/polly/lib/External/isl/isl_schedule_band.c index ed2096160243..e4825f3df6b8 100644 --- a/polly/lib/External/isl/isl_schedule_band.c +++ b/polly/lib/External/isl/isl_schedule_band.c @@ -11,6 +11,8 @@ */ #include +#include +#include #include #include #include diff --git a/polly/lib/External/isl/isl_schedule_constraints.c b/polly/lib/External/isl/isl_schedule_constraints.c index af7ca294bf42..13e8e5f0265a 100644 --- a/polly/lib/External/isl/isl_schedule_constraints.c +++ b/polly/lib/External/isl/isl_schedule_constraints.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -479,10 +480,21 @@ static char *key_str[] = { }; /* Print a key, value pair for the edge of type "type" in "sc" to "p". + * + * If the edge relation is empty, then it is not printed since + * an empty relation is the default value. */ static __isl_give isl_printer *print_constraint(__isl_take isl_printer *p, __isl_keep isl_schedule_constraints *sc, enum isl_edge_type type) { + isl_bool empty; + + empty = isl_union_map_plain_is_empty(sc->constraint[type]); + if (empty < 0) + return isl_printer_free(p); + if (empty) + return p; + p = isl_printer_print_str(p, key_str[type]); p = isl_printer_yaml_next(p); p = isl_printer_print_union_map(p, sc->constraint[type]); @@ -494,10 +506,14 @@ static __isl_give isl_printer *print_constraint(__isl_take isl_printer *p, /* Print "sc" to "p" * * In particular, print the isl_schedule_constraints object as a YAML document. + * Fields with values that are (obviously) equal to their default values + * are not printed. */ __isl_give isl_printer *isl_printer_print_schedule_constraints( __isl_take isl_printer *p, __isl_keep isl_schedule_constraints *sc) { + isl_bool universe; + if (!sc) return isl_printer_free(p); @@ -506,10 +522,15 @@ __isl_give isl_printer *isl_printer_print_schedule_constraints( p = isl_printer_yaml_next(p); p = isl_printer_print_union_set(p, sc->domain); p = isl_printer_yaml_next(p); - p = isl_printer_print_str(p, key_str[isl_sc_key_context]); - p = isl_printer_yaml_next(p); - p = isl_printer_print_set(p, sc->context); - p = isl_printer_yaml_next(p); + universe = isl_set_plain_is_universe(sc->context); + if (universe < 0) + return isl_printer_free(p); + if (!universe) { + p = isl_printer_print_str(p, key_str[isl_sc_key_context]); + p = isl_printer_yaml_next(p); + p = isl_printer_print_set(p, sc->context); + p = isl_printer_yaml_next(p); + } p = print_constraint(p, sc, isl_edge_validity); p = print_constraint(p, sc, isl_edge_proximity); p = print_constraint(p, sc, isl_edge_coincidence); @@ -591,7 +612,11 @@ __isl_give isl_schedule_constraints *isl_stream_read_schedule_constraints( if (!sc) return NULL; break; - default: + case isl_sc_key_validity: + case isl_sc_key_coincidence: + case isl_sc_key_condition: + case isl_sc_key_conditional_validity: + case isl_sc_key_proximity: constraints = read_union_map(s); sc = isl_schedule_constraints_set(sc, key, constraints); if (!sc) diff --git a/polly/lib/External/isl/isl_schedule_node.c b/polly/lib/External/isl/isl_schedule_node.c index 3a53dfe3f91f..4fa5a8e5fa9b 100644 --- a/polly/lib/External/isl/isl_schedule_node.c +++ b/polly/lib/External/isl/isl_schedule_node.c @@ -11,6 +11,8 @@ * B.P. 105 - 78153 Le Chesnay, France */ +#include +#include #include #include #include @@ -294,7 +296,7 @@ int isl_schedule_node_get_schedule_depth(__isl_keep isl_schedule_node *node) * * "initialized" is set if the filter field has been initialized. * If "universe_domain" is not set, then the collected filter is intersected - * with the the domain of the root domain node. + * with the domain of the root domain node. * "universe_filter" is set if we are only collecting the universes of filters * "collect_prefix" is set if we are collecting prefixes. * "filter" collects all outer filters and is NULL until "initialized" is set. @@ -1334,11 +1336,12 @@ static __isl_give isl_schedule_node *preorder_leave( /* Traverse the descendants of "node" (including the node itself) * in depth first preorder. * - * If "fn" returns -1 on any of the nodes, then the traversal is aborted. - * If "fn" returns 0 on any of the nodes, then the subtree rooted + * If "fn" returns isl_bool_error on any of the nodes, + * then the traversal is aborted. + * If "fn" returns isl_bool_false on any of the nodes, then the subtree rooted * at that node is skipped. * - * Return 0 on success and -1 on failure. + * Return isl_stat_ok on success and isl_stat_error on failure. */ isl_stat isl_schedule_node_foreach_descendant_top_down( __isl_keep isl_schedule_node *node, @@ -1354,6 +1357,56 @@ isl_stat isl_schedule_node_foreach_descendant_top_down( return node ? isl_stat_ok : isl_stat_error; } +/* Internal data structure for isl_schedule_node_every_descendant. + * + * "test" is the user-specified callback function. + * "user" is the user-specified callback function argument. + * + * "failed" is initialized to 0 and set to 1 if "test" fails + * on any node. + */ +struct isl_union_map_every_data { + isl_bool (*test)(__isl_keep isl_schedule_node *node, void *user); + void *user; + int failed; +}; + +/* isl_schedule_node_foreach_descendant_top_down callback + * that sets data->failed if data->test returns false and + * subsequently aborts the traversal. + */ +static isl_bool call_every(__isl_keep isl_schedule_node *node, void *user) +{ + struct isl_union_map_every_data *data = user; + isl_bool r; + + r = data->test(node, data->user); + if (r < 0) + return isl_bool_error; + if (r) + return isl_bool_true; + data->failed = 1; + return isl_bool_error; +} + +/* Does "test" succeed on every descendant of "node" (including "node" itself)? + */ +isl_bool isl_schedule_node_every_descendant(__isl_keep isl_schedule_node *node, + isl_bool (*test)(__isl_keep isl_schedule_node *node, void *user), + void *user) +{ + struct isl_union_map_every_data data = { test, user, 0 }; + isl_stat r; + + r = isl_schedule_node_foreach_descendant_top_down(node, &call_every, + &data); + if (r >= 0) + return isl_bool_true; + if (data.failed) + return isl_bool_false; + return isl_bool_error; +} + /* Internal data structure for isl_schedule_node_map_descendant_bottom_up. * * "fn" is the user-specified callback function. @@ -1960,7 +2013,7 @@ __isl_give isl_schedule_node *isl_schedule_node_band_sink( * dimensions and one with the remaining dimensions. * The schedules of the two band nodes live in anonymous spaces. * The loop AST generation type options and the isolate option - * are split over the the two band nodes. + * are split over the two band nodes. */ __isl_give isl_schedule_node *isl_schedule_node_band_split( __isl_take isl_schedule_node *node, int pos) @@ -4286,6 +4339,8 @@ static __isl_give isl_schedule_node *isl_schedule_node_graft_before_or_after( if (isl_schedule_node_get_type(graft) == isl_schedule_node_domain) graft = extension_from_domain(graft, node); + if (!graft) + goto error; if (isl_schedule_node_get_type(graft) != isl_schedule_node_extension) isl_die(isl_schedule_node_get_ctx(node), isl_error_invalid, "expecting domain or extension as root of graft", diff --git a/polly/lib/External/isl/isl_schedule_private.h b/polly/lib/External/isl/isl_schedule_private.h index 9ae4047c41c7..dcf15de2d9e8 100644 --- a/polly/lib/External/isl/isl_schedule_private.h +++ b/polly/lib/External/isl/isl_schedule_private.h @@ -7,11 +7,7 @@ /* A complete schedule tree. * - * band_forest points to a band forest representation of the schedule - * and may be NULL if the forest hasn't been created yet. - * - * "root" is the root of the schedule tree and may be NULL if we - * have created a band forest corresponding to the schedule. + * "root" is the root of the schedule tree. * * "leaf" may be used to represent a leaf of the schedule. * It should not appear as a child to any other isl_schedule_tree objects, @@ -21,7 +17,6 @@ struct isl_schedule { int ref; - isl_band_list *band_forest; isl_schedule_tree *root; struct isl_schedule_tree *leaf; diff --git a/polly/lib/External/isl/isl_schedule_read.c b/polly/lib/External/isl/isl_schedule_read.c index e3ea8c526c92..eafc7208e084 100644 --- a/polly/lib/External/isl/isl_schedule_read.c +++ b/polly/lib/External/isl/isl_schedule_read.c @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/polly/lib/External/isl/isl_schedule_tree.c b/polly/lib/External/isl/isl_schedule_tree.c index 6dbadfcf7e4e..4d80332f9be3 100644 --- a/polly/lib/External/isl/isl_schedule_tree.c +++ b/polly/lib/External/isl/isl_schedule_tree.c @@ -13,6 +13,8 @@ * CS 42112, 75589 Paris Cedex 12, France */ +#include +#include #include #include #include @@ -2265,7 +2267,7 @@ static __isl_give isl_set *isolate_final(__isl_keep isl_set *isolate, * The tree is itself positioned at schedule depth "depth". * * The loop AST generation type options and the isolate option - * are split over the the two band nodes. + * are split over the two band nodes. */ __isl_give isl_schedule_tree *isl_schedule_tree_band_split( __isl_take isl_schedule_tree *tree, int pos, int depth) diff --git a/polly/lib/External/isl/isl_schedule_tree.h b/polly/lib/External/isl/isl_schedule_tree.h index 9bb32c40b7c3..8bc4cf2018e1 100644 --- a/polly/lib/External/isl/isl_schedule_tree.h +++ b/polly/lib/External/isl/isl_schedule_tree.h @@ -31,7 +31,7 @@ ISL_DECLARE_LIST(schedule_tree) * reaching domain element. It does not involve any domain constraints. * * The "extension" field is valid when the is isl_schedule_node_extension - * maps outer schedule dimenions (the flat product of the outer band nodes) + * maps outer schedule dimensions (the flat product of the outer band nodes) * to additional iteration domains. * * The "filter" field is valid when type is isl_schedule_node_filter diff --git a/polly/lib/External/isl/isl_scheduler.c b/polly/lib/External/isl/isl_scheduler.c index 9a93c30711ca..6c7a951bc59e 100644 --- a/polly/lib/External/isl/isl_scheduler.c +++ b/polly/lib/External/isl/isl_scheduler.c @@ -43,6 +43,9 @@ * The scheduling algorithm implemented in this file was inspired by * Bondhugula et al., "Automatic Transformations for Communication-Minimized * Parallelization and Locality Optimization in the Polyhedral Model". + * + * For a detailed description of the variant implemented in isl, + * see Verdoolaege and Janssens, "Scheduling for PPCG" (2017). */ @@ -66,7 +69,7 @@ * linearly independent of previously computed schedule rows. * start is the first variable in the LP problem in the sequences that * represents the schedule coefficients of this node - * nvar is the dimension of the domain + * nvar is the dimension of the (compressed) domain * nparam is the number of parameters or 0 if we are not constructing * a parametric schedule * @@ -285,6 +288,18 @@ static int is_conditional_validity(struct isl_sched_edge *edge) return is_type(edge, isl_edge_conditional_validity); } +/* Is "edge" of a type that can appear multiple times between + * the same pair of nodes? + * + * Condition edges and conditional validity edges may have tagged + * dependence relations, in which case an edge is added for each + * pair of tags. + */ +static int is_multi_edge_type(struct isl_sched_edge *edge) +{ + return is_condition(edge) || is_conditional_validity(edge); +} + /* Internal information about the dependence graph used during * the construction of the schedule. * @@ -308,7 +323,7 @@ static int is_conditional_validity(struct isl_sched_edge *edge) * rows in the node schedules * n_total_row is the current number of rows in the node schedules * band_start is the starting row in the node schedules of the current band - * root is set to the the original dependence graph from which this graph + * root is set to the original dependence graph from which this graph * is derived through splitting. If this graph is not the result of * splitting, then the root field points to the graph itself. * @@ -406,7 +421,7 @@ static int graph_init_table(isl_ctx *ctx, struct isl_sched_graph *graph) } /* Return a pointer to the node that lives within the given space, - * or NULL if there is no such node. + * an invalid node if there is no such node, or NULL in case of error. */ static struct isl_sched_node *graph_find_node(isl_ctx *ctx, struct isl_sched_graph *graph, __isl_keep isl_space *space) @@ -414,11 +429,14 @@ static struct isl_sched_node *graph_find_node(isl_ctx *ctx, struct isl_hash_table_entry *entry; uint32_t hash; + if (!space) + return NULL; + hash = isl_space_get_tuple_hash(space); entry = isl_hash_table_find(ctx, graph->node_table, hash, &node_has_tuples, space, 0); - return entry ? entry->data : NULL; + return entry ? entry->data : graph->node + graph->n; } /* Is "node" a node in "graph"? @@ -458,6 +476,24 @@ static isl_stat graph_edge_table_add(isl_ctx *ctx, return isl_stat_ok; } +/* Add "edge" to all relevant edge tables. + * That is, for every type of the edge, add it to the corresponding table. + */ +static isl_stat graph_edge_tables_add(isl_ctx *ctx, + struct isl_sched_graph *graph, struct isl_sched_edge *edge) +{ + enum isl_edge_type t; + + for (t = isl_edge_first; t <= isl_edge_last; ++t) { + if (!is_type(edge, t)) + continue; + if (graph_edge_table_add(ctx, graph, t, edge) < 0) + return isl_stat_error; + } + + return isl_stat_ok; +} + /* Allocate the edge_tables based on the maximal number of edges of * each type. */ @@ -623,7 +659,11 @@ static isl_bool graph_has_validity_edge(struct isl_sched_graph *graph, return graph_has_edge(graph, isl_edge_conditional_validity, src, dst); } -static int graph_alloc(isl_ctx *ctx, struct isl_sched_graph *graph, +/* Perform all the required memory allocations for a schedule graph "graph" + * with "n_node" nodes and "n_edge" edge and initialize the corresponding + * fields. + */ +static isl_stat graph_alloc(isl_ctx *ctx, struct isl_sched_graph *graph, int n_node, int n_edge) { int i; @@ -643,12 +683,35 @@ static int graph_alloc(isl_ctx *ctx, struct isl_sched_graph *graph, if (!graph->node || !graph->region || (graph->n_edge && !graph->edge) || !graph->sorted) - return -1; + return isl_stat_error; for(i = 0; i < graph->n; ++i) graph->sorted[i] = i; - return 0; + return isl_stat_ok; +} + +/* Free the memory associated to node "node" in "graph". + * The "coincident" field is shared by nodes in a graph and its subgraph. + * It therefore only needs to be freed for the original dependence graph, + * i.e., one that is not the result of splitting. + */ +static void clear_node(struct isl_sched_graph *graph, + struct isl_sched_node *node) +{ + isl_space_free(node->space); + isl_set_free(node->hull); + isl_multi_aff_free(node->compress); + isl_multi_aff_free(node->decompress); + isl_mat_free(node->sched); + isl_map_free(node->sched_map); + isl_mat_free(node->indep); + isl_mat_free(node->vmap); + if (graph->root == graph) + free(node->coincident); + isl_multi_val_free(node->sizes); + isl_basic_set_free(node->bounds); + isl_vec_free(node->max); } static void graph_free(isl_ctx *ctx, struct isl_sched_graph *graph) @@ -660,21 +723,8 @@ static void graph_free(isl_ctx *ctx, struct isl_sched_graph *graph) isl_map_to_basic_set_free(graph->inter_hmap); if (graph->node) - for (i = 0; i < graph->n; ++i) { - isl_space_free(graph->node[i].space); - isl_set_free(graph->node[i].hull); - isl_multi_aff_free(graph->node[i].compress); - isl_multi_aff_free(graph->node[i].decompress); - isl_mat_free(graph->node[i].sched); - isl_map_free(graph->node[i].sched_map); - isl_mat_free(graph->node[i].indep); - isl_mat_free(graph->node[i].vmap); - if (graph->root == graph) - free(graph->node[i].coincident); - isl_multi_val_free(graph->node[i].sizes); - isl_basic_set_free(graph->node[i].bounds); - isl_vec_free(graph->node[i].max); - } + for (i = 0; i < graph->n; ++i) + clear_node(graph, &graph->node[i]); free(graph->node); free(graph->sorted); if (graph->edge) @@ -842,6 +892,7 @@ error: /* Compute and return the size of "set" in dimension "dim". * The size is taken to be the difference in values for that variable * for fixed values of the other variables. + * This assumes that "set" is convex. * In particular, the variable is first isolated from the other variables * in the range of a map * @@ -886,6 +937,10 @@ static __isl_give isl_val *compute_size(__isl_take isl_set *set, int dim) * the bounds need to be set and this is done in set_max_coefficient. * Otherwise, compress the domain if needed, compute the size * in each direction and store the results in node->size. + * If the domain is not convex, then the sizes are computed + * on a convex superset in order to avoid picking up sizes + * that are valid for the individual disjuncts, but not for + * the domain as a whole. * Finally, set the bounds on the coefficients based on the sizes * and the schedule_max_coefficient option in compute_max_coefficient. */ @@ -903,6 +958,7 @@ static isl_stat compute_sizes_and_max(isl_ctx *ctx, struct isl_sched_node *node, if (node->compressed) set = isl_set_preimage_multi_aff(set, isl_multi_aff_copy(node->decompress)); + set = isl_set_from_basic_set(isl_set_simple_hull(set)); mv = isl_multi_val_zero(isl_set_get_space(set)); n = isl_set_dim(set, isl_dim_set); for (j = 0; j < n; ++j) { @@ -1178,8 +1234,8 @@ static __isl_give isl_map *map_intersect_domains(__isl_take isl_map *tagged, return tagged; } -/* Return a pointer to the node that lives in the domain space of "map" - * or NULL if there is no such node. +/* Return a pointer to the node that lives in the domain space of "map", + * an invalid node if there is no such node, or NULL in case of error. */ static struct isl_sched_node *find_domain_node(isl_ctx *ctx, struct isl_sched_graph *graph, __isl_keep isl_map *map) @@ -1194,8 +1250,8 @@ static struct isl_sched_node *find_domain_node(isl_ctx *ctx, return node; } -/* Return a pointer to the node that lives in the range space of "map" - * or NULL if there is no such node. +/* Return a pointer to the node that lives in the range space of "map", + * an invalid node if there is no such node, or NULL in case of error. */ static struct isl_sched_node *find_range_node(isl_ctx *ctx, struct isl_sched_graph *graph, __isl_keep isl_map *map) @@ -1210,6 +1266,18 @@ static struct isl_sched_node *find_range_node(isl_ctx *ctx, return node; } +/* Refrain from adding a new edge based on "map". + * Instead, just free the map. + * "tagged" is either a copy of "map" with additional tags or NULL. + */ +static isl_stat skip_edge(__isl_take isl_map *map, __isl_take isl_map *tagged) +{ + isl_map_free(map); + isl_map_free(tagged); + + return isl_stat_ok; +} + /* Add a new edge to the graph based on the given map * and add it to data->graph->edge_table[data->type]. * If a dependence relation of a given type happens to be identical @@ -1235,6 +1303,7 @@ static struct isl_sched_node *find_range_node(isl_ctx *ctx, */ static isl_stat extract_edge(__isl_take isl_map *map, void *user) { + isl_bool empty; isl_ctx *ctx = isl_map_get_ctx(map); struct isl_extract_edge_data *data = user; struct isl_sched_graph *graph = data->graph; @@ -1255,11 +1324,10 @@ static isl_stat extract_edge(__isl_take isl_map *map, void *user) src = find_domain_node(ctx, graph, map); dst = find_range_node(ctx, graph, map); - if (!src || !dst) { - isl_map_free(map); - isl_map_free(tagged); - return isl_stat_ok; - } + if (!src || !dst) + goto error; + if (!is_node(graph, src) || !is_node(graph, dst)) + return skip_edge(map, tagged); if (src->compressed || dst->compressed) { isl_map *hull; @@ -1269,6 +1337,12 @@ static isl_stat extract_edge(__isl_take isl_map *map, void *user) map = isl_map_intersect(map, hull); } + empty = isl_map_plain_is_empty(map); + if (empty < 0) + goto error; + if (empty) + return skip_edge(map, tagged); + graph->edge[graph->n_edge].src = src; graph->edge[graph->n_edge].dst = dst; graph->edge[graph->n_edge].map = map; @@ -1293,9 +1367,13 @@ static isl_stat extract_edge(__isl_take isl_map *map, void *user) &graph->edge[graph->n_edge++]); if (merge_edge(edge, &graph->edge[graph->n_edge]) < 0) - return -1; + return isl_stat_error; return graph_edge_table_add(ctx, graph, data->type, edge); +error: + isl_map_free(map); + isl_map_free(tagged); + return isl_stat_error; } /* Initialize the schedule graph "graph" from the schedule constraints "sc". @@ -1393,7 +1471,7 @@ static isl_bool node_follows_strong(int i, int j, void *user) /* Use Tarjan's algorithm for computing the strongly connected components * in the dependence graph only considering those edges defined by "follows". */ -static int detect_ccs(isl_ctx *ctx, struct isl_sched_graph *graph, +static isl_stat detect_ccs(isl_ctx *ctx, struct isl_sched_graph *graph, isl_bool (*follows)(int i, int j, void *user)) { int i, n; @@ -1401,7 +1479,7 @@ static int detect_ccs(isl_ctx *ctx, struct isl_sched_graph *graph, g = isl_tarjan_graph_init(ctx, graph->n, follows, graph); if (!g) - return -1; + return isl_stat_error; graph->scc = 0; i = 0; @@ -1418,14 +1496,14 @@ static int detect_ccs(isl_ctx *ctx, struct isl_sched_graph *graph, isl_tarjan_graph_free(g); - return 0; + return isl_stat_ok; } /* Apply Tarjan's algorithm to detect the strongly connected components * in the dependence graph. * Only consider the (conditional) validity dependences and clear "weak". */ -static int detect_sccs(isl_ctx *ctx, struct isl_sched_graph *graph) +static isl_stat detect_sccs(isl_ctx *ctx, struct isl_sched_graph *graph) { graph->weak = 0; return detect_ccs(ctx, graph, &node_follows_strong); @@ -1435,7 +1513,7 @@ static int detect_sccs(isl_ctx *ctx, struct isl_sched_graph *graph) * in the dependence graph. * Consider all dependences and set "weak". */ -static int detect_wccs(isl_ctx *ctx, struct isl_sched_graph *graph) +static isl_stat detect_wccs(isl_ctx *ctx, struct isl_sched_graph *graph) { graph->weak = 1; return detect_ccs(ctx, graph, &node_follows_weak); @@ -1739,7 +1817,7 @@ static __isl_give isl_dim_map *intra_dim_map(isl_ctx *ctx, unsigned total; isl_dim_map *dim_map; - if (!node) + if (!node || !graph->lp) return NULL; total = isl_basic_set_total_dim(graph->lp); @@ -1779,7 +1857,7 @@ static __isl_give isl_dim_map *inter_dim_map(isl_ctx *ctx, unsigned total; isl_dim_map *dim_map; - if (!src || !dst) + if (!src || !dst || !graph->lp) return NULL; total = isl_basic_set_total_dim(graph->lp); @@ -2940,20 +3018,28 @@ static __isl_give isl_aff *extract_schedule_row(__isl_take isl_local_space *ls, isl_int_init(v); aff = isl_aff_zero_on_domain(ls); - isl_mat_get_element(node->sched, row, 0, &v); + if (isl_mat_get_element(node->sched, row, 0, &v) < 0) + goto error; aff = isl_aff_set_constant(aff, v); for (j = 0; j < node->nparam; ++j) { - isl_mat_get_element(node->sched, row, 1 + j, &v); + if (isl_mat_get_element(node->sched, row, 1 + j, &v) < 0) + goto error; aff = isl_aff_set_coefficient(aff, isl_dim_param, j, v); } for (j = 0; j < node->nvar; ++j) { - isl_mat_get_element(node->sched, row, 1 + node->nparam + j, &v); + if (isl_mat_get_element(node->sched, row, + 1 + node->nparam + j, &v) < 0) + goto error; aff = isl_aff_set_coefficient(aff, isl_dim_in, j, v); } isl_int_clear(v); return aff; +error: + isl_int_clear(v); + isl_aff_free(aff); + return NULL; } /* Convert the "n" rows starting at "first" of node->sched into a multi_aff @@ -3066,8 +3152,15 @@ static __isl_give isl_union_map *intersect_domains( * If the dependence is carried completely by the current schedule, then * it is removed from the edge_tables. It is kept in the list of edges * as otherwise all edge_tables would have to be recomputed. + * + * If the edge is of a type that can appear multiple times + * between the same pair of nodes, then it is added to + * the edge table (again). This prevents the situation + * where none of these edges is referenced from the edge table + * because the one that was referenced turned out to be empty and + * was therefore removed from the table. */ -static int update_edge(struct isl_sched_graph *graph, +static isl_stat update_edge(isl_ctx *ctx, struct isl_sched_graph *graph, struct isl_sched_edge *edge) { int empty; @@ -3094,14 +3187,18 @@ static int update_edge(struct isl_sched_graph *graph, empty = isl_map_plain_is_empty(edge->map); if (empty < 0) goto error; - if (empty) + if (empty) { graph_remove_edge(graph, edge); + } else if (is_multi_edge_type(edge)) { + if (graph_edge_tables_add(ctx, graph, edge) < 0) + goto error; + } isl_map_free(id); - return 0; + return isl_stat_ok; error: isl_map_free(id); - return -1; + return isl_stat_error; } /* Does the domain of "umap" intersect "uset"? @@ -3260,8 +3357,8 @@ static int update_edges(isl_ctx *ctx, struct isl_sched_graph *graph) sink = isl_union_set_union(sink, uset); } - for (i = graph->n_edge - 1; i >= 0; --i) { - if (update_edge(graph, &graph->edge[i]) < 0) + for (i = 0; i < graph->n_edge; ++i) { + if (update_edge(ctx, graph, &graph->edge[i]) < 0) goto error; } @@ -3357,7 +3454,8 @@ static __isl_give isl_union_set_list *extract_split(isl_ctx *ctx, /* Copy nodes that satisfy node_pred from the src dependence graph * to the dst dependence graph. */ -static int copy_nodes(struct isl_sched_graph *dst, struct isl_sched_graph *src, +static isl_stat copy_nodes(struct isl_sched_graph *dst, + struct isl_sched_graph *src, int (*node_pred)(struct isl_sched_node *node, int data), int data) { int i; @@ -3388,14 +3486,14 @@ static int copy_nodes(struct isl_sched_graph *dst, struct isl_sched_graph *src, dst->n++; if (!dst->node[j].space || !dst->node[j].sched) - return -1; + return isl_stat_error; if (dst->node[j].compressed && (!dst->node[j].hull || !dst->node[j].compress || !dst->node[j].decompress)) - return -1; + return isl_stat_error; } - return 0; + return isl_stat_ok; } /* Copy non-empty edges that satisfy edge_pred from the src dependence graph @@ -3404,12 +3502,11 @@ static int copy_nodes(struct isl_sched_graph *dst, struct isl_sched_graph *src, * graph, then it must be a backward proximity edge and it should simply * be ignored. */ -static int copy_edges(isl_ctx *ctx, struct isl_sched_graph *dst, +static isl_stat copy_edges(isl_ctx *ctx, struct isl_sched_graph *dst, struct isl_sched_graph *src, int (*edge_pred)(struct isl_sched_edge *edge, int data), int data) { int i; - enum isl_edge_type t; dst->n_edge = 0; for (i = 0; i < src->n_edge; ++i) { @@ -3427,11 +3524,13 @@ static int copy_edges(isl_ctx *ctx, struct isl_sched_graph *dst, dst_src = graph_find_node(ctx, dst, edge->src->space); dst_dst = graph_find_node(ctx, dst, edge->dst->space); - if (!dst_src || !dst_dst) { + if (!dst_src || !dst_dst) + return isl_stat_error; + if (!is_node(dst, dst_src) || !is_node(dst, dst_dst)) { if (is_validity(edge) || is_conditional_validity(edge)) isl_die(ctx, isl_error_internal, "backward (conditional) validity edge", - return -1); + return isl_stat_error); continue; } @@ -3448,21 +3547,16 @@ static int copy_edges(isl_ctx *ctx, struct isl_sched_graph *dst, dst->n_edge++; if (edge->tagged_condition && !tagged_condition) - return -1; + return isl_stat_error; if (edge->tagged_validity && !tagged_validity) - return -1; + return isl_stat_error; - for (t = isl_edge_first; t <= isl_edge_last; ++t) { - if (edge != - graph_find_edge(src, t, edge->src, edge->dst)) - continue; - if (graph_edge_table_add(ctx, dst, t, + if (graph_edge_tables_add(ctx, dst, &dst->edge[dst->n_edge - 1]) < 0) - return -1; - } + return isl_stat_error; } - return 0; + return isl_stat_ok; } /* Compute the maximal number of variables over all nodes. @@ -3491,11 +3585,11 @@ static int compute_maxvar(struct isl_sched_graph *graph) return 0; } -/* Extract the subgraph of "graph" that consists of the node satisfying +/* Extract the subgraph of "graph" that consists of the nodes satisfying * "node_pred" and the edges satisfying "edge_pred" and store * the result in "sub". */ -static int extract_sub_graph(isl_ctx *ctx, struct isl_sched_graph *graph, +static isl_stat extract_sub_graph(isl_ctx *ctx, struct isl_sched_graph *graph, int (*node_pred)(struct isl_sched_node *node, int data), int (*edge_pred)(struct isl_sched_edge *edge, int data), int data, struct isl_sched_graph *sub) @@ -3510,24 +3604,24 @@ static int extract_sub_graph(isl_ctx *ctx, struct isl_sched_graph *graph, if (edge_pred(&graph->edge[i], data)) ++n_edge; if (graph_alloc(ctx, sub, n, n_edge) < 0) - return -1; + return isl_stat_error; sub->root = graph->root; if (copy_nodes(sub, graph, node_pred, data) < 0) - return -1; + return isl_stat_error; if (graph_init_table(ctx, sub) < 0) - return -1; + return isl_stat_error; for (t = 0; t <= isl_edge_last; ++t) sub->max_edge[t] = graph->max_edge[t]; if (graph_init_edge_tables(ctx, sub) < 0) - return -1; + return isl_stat_error; if (copy_edges(ctx, sub, graph, edge_pred, data) < 0) - return -1; + return isl_stat_error; sub->n_row = graph->n_row; sub->max_row = graph->max_row; sub->n_total_row = graph->n_total_row; sub->band_start = graph->band_start; - return 0; + return isl_stat_ok; } static __isl_give isl_schedule_node *compute_schedule(isl_schedule_node *node, @@ -3588,7 +3682,7 @@ static int edge_src_scc_at_least(struct isl_sched_edge *edge, int scc) /* Reset the current band by dropping all its schedule rows. */ -static int reset_band(struct isl_sched_graph *graph) +static isl_stat reset_band(struct isl_sched_graph *graph) { int i; int drop; @@ -3607,10 +3701,10 @@ static int reset_band(struct isl_sched_graph *graph) graph->band_start, drop); if (!node->sched) - return -1; + return isl_stat_error; } - return 0; + return isl_stat_ok; } /* Split the current graph into two parts and compute a schedule for each @@ -3869,6 +3963,8 @@ static void isl_carry_clear(struct isl_carry *carry) /* Return a pointer to the node in "graph" that lives in "space". * If the requested node has been compressed, then "space" * corresponds to the compressed space. + * The graph is assumed to have such a node. + * Return NULL in case of error. * * First try and see if "space" is the space of an uncompressed node. * If so, return that node. @@ -3889,7 +3985,9 @@ static struct isl_sched_node *graph_find_compressed_node(isl_ctx *ctx, return NULL; node = graph_find_node(ctx, graph, space); - if (node) + if (!node) + return NULL; + if (is_node(graph, node)) return node; id = isl_space_get_tuple_id(space, isl_dim_set); @@ -3904,6 +4002,9 @@ static struct isl_sched_node *graph_find_compressed_node(isl_ctx *ctx, "space points to invalid node", return NULL); if (graph != graph->root) node = graph_find_node(ctx, graph, node->space); + if (!is_node(graph, node)) + isl_die(ctx, isl_error_internal, + "unable to find node", return NULL); return node; } @@ -4441,8 +4542,9 @@ static __isl_give isl_vec *non_neg_lexmin(struct isl_sched_graph *graph, int i, pos, cut; isl_ctx *ctx; isl_tab_lexmin *tl; - isl_vec *sol, *prev = NULL; + isl_vec *sol = NULL, *prev; int treat_coalescing; + int try_again; if (!lp) return NULL; @@ -4454,8 +4556,10 @@ static __isl_give isl_vec *non_neg_lexmin(struct isl_sched_graph *graph, do { int integral; + try_again = 0; if (cut) tl = isl_tab_lexmin_cut_to_integer(tl); + prev = sol; sol = non_empty_solution(tl); if (!sol) goto error; @@ -4471,7 +4575,7 @@ static __isl_give isl_vec *non_neg_lexmin(struct isl_sched_graph *graph, prev = isl_vec_free(prev); cut = want_integral && !integral; if (cut) - prev = sol; + try_again = 1; if (!treat_coalescing) continue; for (i = 0; i < graph->n; ++i) { @@ -4484,11 +4588,11 @@ static __isl_give isl_vec *non_neg_lexmin(struct isl_sched_graph *graph, break; } if (i < graph->n) { - prev = sol; + try_again = 1; tl = zero_out_node_coef(tl, &graph->node[i], pos); cut = 0; } - } while (prev); + } while (try_again); isl_tab_lexmin_free(tl); @@ -5451,22 +5555,26 @@ error: * In each case, we first insert a band node in the schedule tree * if any rows have been computed. * - * If the caller managed to complete the schedule, we insert a band node - * (if any schedule rows were computed) and we finish off by topologically + * If the caller managed to complete the schedule and the current band + * is empty, then finish off by topologically * sorting the statements based on the remaining dependences. + * If, on the other hand, the current band has at least one row, + * then continue with the next band. Note that this next band + * will necessarily be empty, but the graph may still be split up + * into weakly connected components before arriving back here. */ static __isl_give isl_schedule_node *compute_schedule_finish_band( __isl_take isl_schedule_node *node, struct isl_sched_graph *graph, int initialized) { - int insert; + int empty; if (!node) return NULL; + empty = graph->n_total_row == graph->band_start; if (graph->n_row < graph->maxvar) { isl_ctx *ctx; - int empty = graph->n_total_row == graph->band_start; ctx = isl_schedule_node_get_ctx(node); if (!ctx->opt->schedule_maximize_band_depth && !empty) @@ -5484,16 +5592,9 @@ static __isl_give isl_schedule_node *compute_schedule_finish_band( return carry_dependences(node, graph); } - insert = graph->n_total_row > graph->band_start; - if (insert) { - node = insert_current_band(node, graph, 1); - node = isl_schedule_node_child(node, 0); - } - node = sort_statements(node, graph, initialized); - if (insert) - node = isl_schedule_node_parent(node); - - return node; + if (!empty) + return compute_next_band(node, graph, 1); + return sort_statements(node, graph, initialized); } /* Construct a band of schedule rows for a connected dependence graph. @@ -6332,12 +6433,15 @@ static __isl_give isl_map *extract_node_transformation(isl_ctx *ctx, isl_multi_aff *ma, *ma2; scc_node = graph_find_node(ctx, &c->scc[node->scc], node->space); + if (scc_node && !is_node(&c->scc[node->scc], scc_node)) + isl_die(ctx, isl_error_internal, "unable to find node", + return NULL); start = c->scc[node->scc].band_start; n = c->scc[node->scc].n_total_row - start; ma = node_extract_partial_schedule_multi_aff(scc_node, start, n); space = cluster_space(&c->scc[node->scc], c->scc_cluster[node->scc]); cluster_node = graph_find_node(ctx, merge_graph, space); - if (space && !cluster_node) + if (cluster_node && !is_node(merge_graph, cluster_node)) isl_die(ctx, isl_error_internal, "unable to find cluster", space = isl_space_free(space)); id = isl_space_get_tuple_id(space, isl_dim_set); @@ -6684,11 +6788,11 @@ static isl_stat merge(isl_ctx *ctx, struct isl_clustering *c, if (cluster < 0) cluster = i; space = cluster_space(&c->scc[i], c->scc_cluster[i]); - if (!space) - return isl_stat_error; node = graph_find_node(ctx, merge_graph, space); isl_space_free(space); if (!node) + return isl_stat_error; + if (!is_node(merge_graph, node)) isl_die(ctx, isl_error_internal, "unable to find cluster", return isl_stat_error); @@ -7171,6 +7275,14 @@ static __isl_give isl_schedule_node *compute_schedule_wcc( * weakly connected component in the dependence graph so that * there is no need for compute_sub_schedule to look for weakly * connected components. + * + * If a set node would be introduced and if the number of components + * is equal to the number of nodes, then check if the schedule + * is already complete. If so, a redundant set node would be introduced + * (without any further descendants) stating that the statements + * can be executed in arbitrary order, which is also expressed + * by the absence of any node. Refrain from inserting any nodes + * in this case and simply return. */ static __isl_give isl_schedule_node *compute_component_schedule( __isl_take isl_schedule_node *node, struct isl_sched_graph *graph, @@ -7182,8 +7294,15 @@ static __isl_give isl_schedule_node *compute_component_schedule( if (!node) return NULL; - ctx = isl_schedule_node_get_ctx(node); + if (graph->weak && graph->scc == graph->n) { + if (compute_maxvar(graph) < 0) + return isl_schedule_node_free(node); + if (graph->n_row >= graph->maxvar) + return node; + } + + ctx = isl_schedule_node_get_ctx(node); filters = extract_sccs(ctx, graph); if (graph->weak) node = isl_schedule_node_insert_set(node, filters); diff --git a/polly/lib/External/isl/isl_space.c b/polly/lib/External/isl/isl_space.c index 0ddacc23b348..53beee660da5 100644 --- a/polly/lib/External/isl/isl_space.c +++ b/polly/lib/External/isl/isl_space.c @@ -821,15 +821,6 @@ isl_bool isl_space_tuple_is_equal(__isl_keep isl_space *space1, return isl_bool_true; } -/* This is the old, undocumented, name for isl_space_tuple_is_equal. - * It will be removed at some point. - */ -int isl_space_tuple_match(__isl_keep isl_space *space1, enum isl_dim_type type1, - __isl_keep isl_space *space2, enum isl_dim_type type2) -{ - return isl_space_tuple_is_equal(space1, type1, space2, type2); -} - static isl_bool match(__isl_keep isl_space *space1, enum isl_dim_type type1, __isl_keep isl_space *space2, enum isl_dim_type type2) { @@ -985,6 +976,33 @@ error: return NULL; } +/* Add a parameter with identifier "id" to "space", provided + * it does not already appear in "space". + */ +__isl_give isl_space *isl_space_add_param_id(__isl_take isl_space *space, + __isl_take isl_id *id) +{ + int pos; + + if (!space || !id) + goto error; + + if (isl_space_find_dim_by_id(space, isl_dim_param, id) >= 0) { + isl_id_free(id); + return space; + } + + pos = isl_space_dim(space, isl_dim_param); + space = isl_space_add_dims(space, isl_dim_param, 1); + space = isl_space_set_dim_id(space, isl_dim_param, pos, id); + + return space; +error: + isl_space_free(space); + isl_id_free(id); + return NULL; +} + static int valid_dim_type(enum isl_dim_type type) { switch (type) { @@ -1157,8 +1175,8 @@ __isl_give isl_space *isl_space_move_dims(__isl_take isl_space *space, for (i = 0; i < 2; ++i) { if (!space->nested[i]) continue; - space->nested[i] = isl_space_replace(space->nested[i], - isl_dim_param, space); + space->nested[i] = isl_space_replace_params(space->nested[i], + space); if (!space->nested[i]) goto error; } @@ -1321,15 +1339,6 @@ error: return NULL; } -/* Given a space of the form [A -> B] -> [C -> D], return the space A -> C. - */ -__isl_give isl_space *isl_space_factor_domain(__isl_take isl_space *space) -{ - space = isl_space_domain_factor_domain(space); - space = isl_space_range_factor_domain(space); - return space; -} - /* Given a space of the form [A -> B] -> C, return the space A -> C. */ __isl_give isl_space *isl_space_domain_factor_domain( @@ -1407,19 +1416,18 @@ error: return NULL; } -/* Given a space of the form A -> [B -> C], return the space A -> B. +/* Internal function that selects the domain of the map that is + * embedded in either a set space or the range of a map space. + * In particular, given a space of the form [A -> B], return the space A. + * Given a space of the form A -> [B -> C], return the space A -> B. */ -__isl_give isl_space *isl_space_range_factor_domain( - __isl_take isl_space *space) +static __isl_give isl_space *range_factor_domain(__isl_take isl_space *space) { isl_space *nested; isl_space *domain; if (!space) return NULL; - if (!isl_space_range_is_wrapping(space)) - isl_die(isl_space_get_ctx(space), isl_error_invalid, - "range not a product", return isl_space_free(space)); nested = space->nested[1]; domain = isl_space_copy(space); @@ -1446,6 +1454,47 @@ error: return NULL; } +/* Given a space of the form A -> [B -> C], return the space A -> B. + */ +__isl_give isl_space *isl_space_range_factor_domain( + __isl_take isl_space *space) +{ + if (!space) + return NULL; + if (!isl_space_range_is_wrapping(space)) + isl_die(isl_space_get_ctx(space), isl_error_invalid, + "range not a product", return isl_space_free(space)); + + return range_factor_domain(space); +} + +/* Given a space of the form [A -> B], return the space A. + */ +static __isl_give isl_space *set_factor_domain(__isl_take isl_space *space) +{ + if (!space) + return NULL; + if (!isl_space_is_wrapping(space)) + isl_die(isl_space_get_ctx(space), isl_error_invalid, + "not a product", return isl_space_free(space)); + + return range_factor_domain(space); +} + +/* Given a space of the form [A -> B] -> [C -> D], return the space A -> C. + * Given a space of the form [A -> B], return the space A. + */ +__isl_give isl_space *isl_space_factor_domain(__isl_take isl_space *space) +{ + if (!space) + return NULL; + if (isl_space_is_set(space)) + return set_factor_domain(space); + space = isl_space_domain_factor_domain(space); + space = isl_space_range_factor_domain(space); + return space; +} + /* Internal function that selects the range of the map that is * embedded in either a set space or the range of a map space. * In particular, given a space of the form [A -> B], return the space B. @@ -2212,31 +2261,33 @@ __isl_give isl_space *isl_space_flatten(__isl_take isl_space *dim) return dim; } -__isl_give isl_space *isl_space_flatten_domain(__isl_take isl_space *dim) +__isl_give isl_space *isl_space_flatten_domain(__isl_take isl_space *space) { - if (!dim) + if (!space) return NULL; - if (!dim->nested[0]) - return dim; + if (!space->nested[0]) + return space; - return isl_space_reset(dim, isl_dim_in); + return isl_space_reset(space, isl_dim_in); } -__isl_give isl_space *isl_space_flatten_range(__isl_take isl_space *dim) +__isl_give isl_space *isl_space_flatten_range(__isl_take isl_space *space) { - if (!dim) + if (!space) return NULL; - if (!dim->nested[1]) - return dim; + if (!space->nested[1]) + return space; - return isl_space_reset(dim, isl_dim_out); + return isl_space_reset(space, isl_dim_out); } -/* Replace the dimensions of the given type of dst by those of src. +/* Replace the parameters of dst by those of src. */ -__isl_give isl_space *isl_space_replace(__isl_take isl_space *dst, - enum isl_dim_type type, __isl_keep isl_space *src) +__isl_give isl_space *isl_space_replace_params(__isl_take isl_space *dst, + __isl_keep isl_space *src) { + enum isl_dim_type type = isl_dim_param; + dst = isl_space_cow(dst); if (!dst || !src) @@ -2246,13 +2297,13 @@ __isl_give isl_space *isl_space_replace(__isl_take isl_space *dst, dst = isl_space_add_dims(dst, type, isl_space_dim(src, type)); dst = copy_ids(dst, type, 0, src, type); - if (dst && type == isl_dim_param) { + if (dst) { int i; for (i = 0; i <= 1; ++i) { if (!dst->nested[i]) continue; - dst->nested[i] = isl_space_replace(dst->nested[i], - type, src); + dst->nested[i] = isl_space_replace_params( + dst->nested[i], src); if (!dst->nested[i]) goto error; } diff --git a/polly/lib/External/isl/isl_space_private.h b/polly/lib/External/isl/isl_space_private.h index 783ba43ceaef..0912302dbca7 100644 --- a/polly/lib/External/isl/isl_space_private.h +++ b/polly/lib/External/isl/isl_space_private.h @@ -50,11 +50,9 @@ isl_stat isl_space_check_equal_params(__isl_keep isl_space *space1, __isl_give isl_space *isl_space_reset(__isl_take isl_space *dim, enum isl_dim_type type); __isl_give isl_space *isl_space_flatten(__isl_take isl_space *dim); -__isl_give isl_space *isl_space_flatten_domain(__isl_take isl_space *dim); -__isl_give isl_space *isl_space_flatten_range(__isl_take isl_space *dim); -__isl_give isl_space *isl_space_replace(__isl_take isl_space *dst, - enum isl_dim_type type, __isl_keep isl_space *src); +__isl_give isl_space *isl_space_replace_params(__isl_take isl_space *dst, + __isl_keep isl_space *src); __isl_give isl_space *isl_space_lift(__isl_take isl_space *dim, unsigned n_local); diff --git a/polly/lib/External/isl/isl_stream.c b/polly/lib/External/isl/isl_stream.c index cf1fd5e7d3dd..beb06a64539d 100644 --- a/polly/lib/External/isl/isl_stream.c +++ b/polly/lib/External/isl/isl_stream.c @@ -725,8 +725,11 @@ int isl_stream_eat(__isl_keep isl_stream *s, int type) struct isl_token *tok; tok = isl_stream_next_token(s); - if (!tok) + if (!tok) { + if (s->eof) + isl_stream_error(s, NULL, "unexpected EOF"); return -1; + } if (tok->type == type) { isl_token_free(tok); return 0; diff --git a/polly/lib/External/isl/isl_stride.c b/polly/lib/External/isl/isl_stride.c new file mode 100644 index 000000000000..8e96064577f9 --- /dev/null +++ b/polly/lib/External/isl/isl_stride.c @@ -0,0 +1,324 @@ +/* + * Copyright 2012-2013 Ecole Normale Superieure + * + * Use of this software is governed by the MIT license + * + * Written by Sven Verdoolaege, + * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France + */ + +#include +#include +#include +#include + +/* Stride information about a specific set dimension. + * The values of the set dimension are equal to + * "offset" plus a multiple of "stride". + */ +struct isl_stride_info { + isl_val *stride; + isl_aff *offset; +}; + +/* Free "si" and return NULL. + */ +__isl_null isl_stride_info *isl_stride_info_free( + __isl_take isl_stride_info *si) +{ + if (!si) + return NULL; + isl_val_free(si->stride); + isl_aff_free(si->offset); + free(si); + return NULL; +} + +/* Construct an isl_stride_info object with given offset and stride. + */ +__isl_give isl_stride_info *isl_stride_info_alloc( + __isl_take isl_val *stride, __isl_take isl_aff *offset) +{ + struct isl_stride_info *si; + + if (!stride || !offset) + goto error; + si = isl_alloc_type(isl_val_get_ctx(stride), struct isl_stride_info); + if (!si) + goto error; + si->stride = stride; + si->offset = offset; + return si; +error: + isl_val_free(stride); + isl_aff_free(offset); + return NULL; +} + +/* Return the stride of "si". + */ +__isl_give isl_val *isl_stride_info_get_stride(__isl_keep isl_stride_info *si) +{ + if (!si) + return NULL; + return isl_val_copy(si->stride); +} + +/* Return the offset of "si". + */ +__isl_give isl_aff *isl_stride_info_get_offset(__isl_keep isl_stride_info *si) +{ + if (!si) + return NULL; + return isl_aff_copy(si->offset); +} + +/* Information used inside detect_stride. + * + * "pos" is the set dimension at which the stride is being determined. + * "want_offset" is set if the offset should be computed. + * "found" is set if some stride was found already. + * "stride" and "offset" contain the (combined) stride and offset + * found so far and are NULL when "found" is not set. + * If "want_offset" is not set, then "offset" remains NULL. + */ +struct isl_detect_stride_data { + int pos; + int want_offset; + int found; + isl_val *stride; + isl_aff *offset; +}; + +/* Set the stride and offset of data->pos to the given + * value and expression. + * + * If we had already found a stride before, then the two strides + * are combined into a single stride. + * + * In particular, if the new stride information is of the form + * + * i = f + s (...) + * + * and the old stride information is of the form + * + * i = f2 + s2 (...) + * + * then we compute the extended gcd of s and s2 + * + * a s + b s2 = g, + * + * with g = gcd(s,s2), multiply the first equation with t1 = b s2/g + * and the second with t2 = a s1/g. + * This results in + * + * i = (b s2 + a s1)/g i = t1 f + t2 f2 + (s s2)/g (...) + * + * so that t1 f + t2 f2 is the combined offset and (s s2)/g = lcm(s,s2) + * is the combined stride. + */ +static isl_stat set_stride(struct isl_detect_stride_data *data, + __isl_take isl_val *stride, __isl_take isl_aff *offset) +{ + int pos; + + if (!stride || !offset) + goto error; + + pos = data->pos; + + if (data->found) { + isl_val *stride2, *a, *b, *g; + isl_aff *offset2; + + stride2 = data->stride; + g = isl_val_gcdext(isl_val_copy(stride), isl_val_copy(stride2), + &a, &b); + a = isl_val_mul(a, isl_val_copy(stride)); + a = isl_val_div(a, isl_val_copy(g)); + stride2 = isl_val_div(stride2, g); + b = isl_val_mul(b, isl_val_copy(stride2)); + stride = isl_val_mul(stride, stride2); + + if (!data->want_offset) { + isl_val_free(a); + isl_val_free(b); + } else { + offset2 = data->offset; + offset2 = isl_aff_scale_val(offset2, a); + offset = isl_aff_scale_val(offset, b); + offset = isl_aff_add(offset, offset2); + } + } + + data->found = 1; + data->stride = stride; + if (data->want_offset) + data->offset = offset; + else + isl_aff_free(offset); + if (!data->stride || (data->want_offset && !data->offset)) + return isl_stat_error; + + return isl_stat_ok; +error: + isl_val_free(stride); + isl_aff_free(offset); + return isl_stat_error; +} + +/* Check if constraint "c" imposes any stride on dimension data->pos + * and, if so, update the stride information in "data". + * + * In order to impose a stride on the dimension, "c" needs to be an equality + * and it needs to involve the dimension. Note that "c" may also be + * a div constraint and thus an inequality that we cannot use. + * + * Let c be of the form + * + * h(p) + g * v * i + g * stride * f(alpha) = 0 + * + * with h(p) an expression in terms of the parameters and other dimensions + * and f(alpha) an expression in terms of the existentially quantified + * variables. + * + * If "stride" is not zero and not one, then it represents a non-trivial stride + * on "i". We compute a and b such that + * + * a v + b stride = 1 + * + * We have + * + * g v i = -h(p) + g stride f(alpha) + * + * a g v i = -a h(p) + g stride f(alpha) + * + * a g v i + b g stride i = -a h(p) + g stride * (...) + * + * g i = -a h(p) + g stride * (...) + * + * i = -a h(p)/g + stride * (...) + * + * The expression "-a h(p)/g" can therefore be used as offset. + */ +static isl_stat detect_stride(__isl_take isl_constraint *c, void *user) +{ + struct isl_detect_stride_data *data = user; + int i, n_div; + isl_ctx *ctx; + isl_stat r = isl_stat_ok; + isl_val *v, *stride, *m; + + if (!isl_constraint_is_equality(c) || + !isl_constraint_involves_dims(c, isl_dim_set, data->pos, 1)) { + isl_constraint_free(c); + return isl_stat_ok; + } + + ctx = isl_constraint_get_ctx(c); + stride = isl_val_zero(ctx); + n_div = isl_constraint_dim(c, isl_dim_div); + for (i = 0; i < n_div; ++i) { + v = isl_constraint_get_coefficient_val(c, isl_dim_div, i); + stride = isl_val_gcd(stride, v); + } + + v = isl_constraint_get_coefficient_val(c, isl_dim_set, data->pos); + m = isl_val_gcd(isl_val_copy(stride), isl_val_copy(v)); + stride = isl_val_div(stride, isl_val_copy(m)); + v = isl_val_div(v, isl_val_copy(m)); + + if (!isl_val_is_zero(stride) && !isl_val_is_one(stride)) { + isl_aff *aff; + isl_val *gcd, *a, *b; + + gcd = isl_val_gcdext(v, isl_val_copy(stride), &a, &b); + isl_val_free(gcd); + isl_val_free(b); + + aff = isl_constraint_get_aff(c); + for (i = 0; i < n_div; ++i) + aff = isl_aff_set_coefficient_si(aff, + isl_dim_div, i, 0); + aff = isl_aff_set_coefficient_si(aff, isl_dim_in, data->pos, 0); + a = isl_val_neg(a); + aff = isl_aff_scale_val(aff, a); + aff = isl_aff_scale_down_val(aff, m); + r = set_stride(data, stride, aff); + } else { + isl_val_free(stride); + isl_val_free(m); + isl_val_free(v); + } + + isl_constraint_free(c); + return r; +} + +/* Check if the constraints in "set" imply any stride on set dimension "pos" and + * store the results in data->stride and data->offset. + * + * In particular, compute the affine hull and then check if + * any of the constraints in the hull impose any stride on the dimension. + * If no such constraint can be found, then the offset is taken + * to be the zero expression and the stride is taken to be one. + */ +static void set_detect_stride(__isl_keep isl_set *set, int pos, + struct isl_detect_stride_data *data) +{ + isl_basic_set *hull; + + hull = isl_set_affine_hull(isl_set_copy(set)); + + data->pos = pos; + data->found = 0; + data->stride = NULL; + data->offset = NULL; + if (isl_basic_set_foreach_constraint(hull, &detect_stride, data) < 0) + goto error; + + if (!data->found) { + data->stride = isl_val_one(isl_set_get_ctx(set)); + if (data->want_offset) { + isl_space *space; + isl_local_space *ls; + + space = isl_set_get_space(set); + ls = isl_local_space_from_space(space); + data->offset = isl_aff_zero_on_domain(ls); + } + } + isl_basic_set_free(hull); + return; +error: + isl_basic_set_free(hull); + data->stride = isl_val_free(data->stride); + data->offset = isl_aff_free(data->offset); +} + +/* Check if the constraints in "set" imply any stride on set dimension "pos" and + * return the results in the form of an offset and a stride. + */ +__isl_give isl_stride_info *isl_set_get_stride_info(__isl_keep isl_set *set, + int pos) +{ + struct isl_detect_stride_data data; + + data.want_offset = 1; + set_detect_stride(set, pos, &data); + + return isl_stride_info_alloc(data.stride, data.offset); +} + +/* Check if the constraints in "set" imply any stride on set dimension "pos" and + * return this stride. + */ +__isl_give isl_val *isl_set_get_stride(__isl_keep isl_set *set, int pos) +{ + struct isl_detect_stride_data data; + + data.want_offset = 0; + set_detect_stride(set, pos, &data); + + return data.stride; +} diff --git a/polly/lib/External/isl/isl_tab.c b/polly/lib/External/isl/isl_tab.c index fd184c5440ee..4a81b24d8a3d 100644 --- a/polly/lib/External/isl/isl_tab.c +++ b/polly/lib/External/isl/isl_tab.c @@ -786,30 +786,42 @@ static void swap_rows(struct isl_tab *tab, int row1, int row2) tab->row_sign[row2] = s; } -static int push_union(struct isl_tab *tab, +static isl_stat push_union(struct isl_tab *tab, enum isl_tab_undo_type type, union isl_tab_undo_val u) WARN_UNUSED; -static int push_union(struct isl_tab *tab, + +/* Push record "u" onto the undo stack of "tab", provided "tab" + * keeps track of undo information. + * + * If the record cannot be pushed, then mark the undo stack as invalid + * such that a later rollback attempt will not try to undo earlier + * records without having been able to undo the current record. + */ +static isl_stat push_union(struct isl_tab *tab, enum isl_tab_undo_type type, union isl_tab_undo_val u) { struct isl_tab_undo *undo; if (!tab) - return -1; + return isl_stat_error; if (!tab->need_undo) - return 0; + return isl_stat_ok; undo = isl_alloc_type(tab->mat->ctx, struct isl_tab_undo); if (!undo) - return -1; + goto error; undo->type = type; undo->u = u; undo->next = tab->top; tab->top = undo; - return 0; + return isl_stat_ok; +error: + free_undo(tab); + tab->top = NULL; + return isl_stat_error; } -int isl_tab_push_var(struct isl_tab *tab, +isl_stat isl_tab_push_var(struct isl_tab *tab, enum isl_tab_undo_type type, struct isl_tab_var *var) { union isl_tab_undo_val u; @@ -820,7 +832,7 @@ int isl_tab_push_var(struct isl_tab *tab, return push_union(tab, type, u); } -int isl_tab_push(struct isl_tab *tab, enum isl_tab_undo_type type) +isl_stat isl_tab_push(struct isl_tab *tab, enum isl_tab_undo_type type) { union isl_tab_undo_val u = { 0 }; return push_union(tab, type, u); @@ -829,20 +841,21 @@ int isl_tab_push(struct isl_tab *tab, enum isl_tab_undo_type type) /* Push a record on the undo stack describing the current basic * variables, so that the this state can be restored during rollback. */ -int isl_tab_push_basis(struct isl_tab *tab) +isl_stat isl_tab_push_basis(struct isl_tab *tab) { int i; union isl_tab_undo_val u; u.col_var = isl_alloc_array(tab->mat->ctx, int, tab->n_col); if (tab->n_col && !u.col_var) - return -1; + return isl_stat_error; for (i = 0; i < tab->n_col; ++i) u.col_var[i] = tab->col_var[i]; return push_union(tab, isl_tab_undo_saved_basis, u); } -int isl_tab_push_callback(struct isl_tab *tab, struct isl_tab_callback *callback) +isl_stat isl_tab_push_callback(struct isl_tab *tab, + struct isl_tab_callback *callback) { union isl_tab_undo_val u; u.callback = callback; @@ -917,12 +930,12 @@ struct isl_tab *isl_tab_drop_sample(struct isl_tab *tab, int s) /* Record the current number of samples so that we can remove newer * samples during a rollback. */ -int isl_tab_save_samples(struct isl_tab *tab) +isl_stat isl_tab_save_samples(struct isl_tab *tab) { union isl_tab_undo_val u; if (!tab) - return -1; + return isl_stat_error; u.n = tab->n_sample; return push_union(tab, isl_tab_undo_saved_samples, u); diff --git a/polly/lib/External/isl/isl_tab.h b/polly/lib/External/isl/isl_tab.h index a1dacd9f30c5..f3a4dfbe9f18 100644 --- a/polly/lib/External/isl/isl_tab.h +++ b/polly/lib/External/isl/isl_tab.h @@ -308,23 +308,24 @@ int isl_tab_min_at_most_neg_one(struct isl_tab *tab, struct isl_tab_var *var); int isl_tab_sign_of_max(struct isl_tab *tab, int con); int isl_tab_kill_col(struct isl_tab *tab, int col) WARN_UNUSED; -int isl_tab_push(struct isl_tab *tab, enum isl_tab_undo_type type) WARN_UNUSED; -int isl_tab_push_var(struct isl_tab *tab, +isl_stat isl_tab_push(struct isl_tab *tab, enum isl_tab_undo_type type) + WARN_UNUSED; +isl_stat isl_tab_push_var(struct isl_tab *tab, enum isl_tab_undo_type type, struct isl_tab_var *var) WARN_UNUSED; -int isl_tab_push_basis(struct isl_tab *tab) WARN_UNUSED; +isl_stat isl_tab_push_basis(struct isl_tab *tab) WARN_UNUSED; struct isl_tab *isl_tab_init_samples(struct isl_tab *tab) WARN_UNUSED; int isl_tab_add_sample(struct isl_tab *tab, __isl_take isl_vec *sample) WARN_UNUSED; struct isl_tab *isl_tab_drop_sample(struct isl_tab *tab, int s); -int isl_tab_save_samples(struct isl_tab *tab) WARN_UNUSED; +isl_stat isl_tab_save_samples(struct isl_tab *tab) WARN_UNUSED; struct isl_tab *isl_tab_detect_equalities(struct isl_tab *tab, struct isl_tab *tab_cone) WARN_UNUSED; isl_bool isl_tab_is_constant(struct isl_tab *tab, int var, isl_int *value); isl_stat isl_tab_detect_constants(struct isl_tab *tab); -int isl_tab_push_callback(struct isl_tab *tab, +isl_stat isl_tab_push_callback(struct isl_tab *tab, struct isl_tab_callback *callback) WARN_UNUSED; int isl_tab_insert_div(struct isl_tab *tab, int pos, __isl_keep isl_vec *div, diff --git a/polly/lib/External/isl/isl_tab_pip.c b/polly/lib/External/isl/isl_tab_pip.c index d4747b4807aa..c50103427e9c 100644 --- a/polly/lib/External/isl/isl_tab_pip.c +++ b/polly/lib/External/isl/isl_tab_pip.c @@ -173,13 +173,11 @@ struct isl_sol_callback { * * The context tableau is owned by isl_sol and is updated incrementally. * - * There are currently three implementations of this interface, + * There are currently two implementations of this interface, * isl_sol_map, which simply collects the solutions in an isl_map * and (optionally) the parts of the context where there is no solution - * in an isl_set, - * isl_sol_pma, which collects an isl_pw_multi_aff instead, and - * isl_sol_for, which calls a user-defined function for each part of - * the solution. + * in an isl_set, and + * isl_sol_pma, which collects an isl_pw_multi_aff instead. */ struct isl_sol { int error; @@ -1166,7 +1164,7 @@ static int is_obviously_nonneg(struct isl_tab *tab, int row) * Pivoting with column c will increment the sample value by a non-negative * constant times a_{V,c}/a_{r,c}, with a_{V,c} the elements of column c * corresponding to the non-parametric variables. - * If variable v appears in a column c_v, the a_{v,c} = 1 iff c = c_v, + * If variable v appears in a column c_v, then a_{v,c} = 1 iff c = c_v, * with all other entries in this virtual row equal to zero. * If variable v appears in a row, then a_{v,c} is the element in column c * of that row. @@ -1219,6 +1217,37 @@ static int lexmin_col_pair(struct isl_tab *tab, return -1; } +/* Does the index into the tab->var or tab->con array "index" + * correspond to a variable in the context tableau? + * In particular, it needs to be an index into the tab->var array and + * it needs to refer to either one of the first tab->n_param variables or + * one of the last tab->n_div variables. + */ +static int is_parameter_var(struct isl_tab *tab, int index) +{ + if (index < 0) + return 0; + if (index < tab->n_param) + return 1; + if (index >= tab->n_var - tab->n_div) + return 1; + return 0; +} + +/* Does column "col" of "tab" refer to a variable in the context tableau? + */ +static int col_is_parameter_var(struct isl_tab *tab, int col) +{ + return is_parameter_var(tab, tab->col_var[col]); +} + +/* Does row "row" of "tab" refer to a variable in the context tableau? + */ +static int row_is_parameter_var(struct isl_tab *tab, int row) +{ + return is_parameter_var(tab, tab->row_var[row]); +} + /* Given a row in the tableau, find and return the column that would * result in the lexicographically smallest, but positive, increment * in the sample point. @@ -1237,9 +1266,7 @@ static int lexmin_pivot_col(struct isl_tab *tab, int row) isl_int_init(tmp); for (j = tab->n_dead; j < tab->n_col; ++j) { - if (tab->col_var[j] >= 0 && - (tab->col_var[j] < tab->n_param || - tab->col_var[j] >= tab->n_var - tab->n_div)) + if (col_is_parameter_var(tab, j)) continue; if (!isl_int_is_pos(tr[j])) @@ -1309,9 +1336,7 @@ static void check_lexpos(struct isl_tab *tab) int row; for (col = tab->n_dead; col < tab->n_col; ++col) { - if (tab->col_var[col] >= 0 && - (tab->col_var[col] < tab->n_param || - tab->col_var[col] >= tab->n_var - tab->n_div)) + if (col_is_parameter_var(tab, col)) continue; for (var = tab->n_param; var < tab->n_var - tab->n_div; ++var) { if (!tab->var[var].is_row) { @@ -1361,9 +1386,7 @@ static int report_conflict(struct isl_tab *tab, int row) tr = tab->mat->row[row] + 2 + tab->M; for (j = tab->n_dead; j < tab->n_col; ++j) { - if (tab->col_var[j] >= 0 && - (tab->col_var[j] < tab->n_param || - tab->col_var[j] >= tab->n_var - tab->n_div)) + if (col_is_parameter_var(tab, j)) continue; if (!isl_int_is_neg(tr[j])) @@ -1511,6 +1534,25 @@ static int is_constant(struct isl_tab *tab, int row) tab->n_col - tab->n_dead) == -1; } +/* Is the given row a parametric constant? + * That is, does it only involve variables that also appear in the context? + */ +static int is_parametric_constant(struct isl_tab *tab, int row) +{ + unsigned off = 2 + tab->M; + int col; + + for (col = tab->n_dead; col < tab->n_col; ++col) { + if (col_is_parameter_var(tab, col)) + continue; + if (isl_int_is_zero(tab->mat->row[row][off + col])) + continue; + return 0; + } + + return 1; +} + /* Add an equality that may or may not be valid to the tableau. * If the resulting row is a pure constant, then it must be zero. * Otherwise, the resulting tableau is empty. @@ -1675,9 +1717,7 @@ static int integer_variable(struct isl_tab *tab, int row) unsigned off = 2 + tab->M; for (i = tab->n_dead; i < tab->n_col; ++i) { - if (tab->col_var[i] >= 0 && - (tab->col_var[i] < tab->n_param || - tab->col_var[i] >= tab->n_var - tab->n_div)) + if (col_is_parameter_var(tab, i)) continue; if (!isl_int_is_divisible_by(tab->mat->row[row][off + i], tab->mat->row[row][0])) @@ -2107,7 +2147,7 @@ static int get_div(struct isl_tab *tab, struct isl_context *context, } /* Add a parametric cut to cut away the non-integral sample value - * of the give row. + * of the given row. * Let a_i be the coefficients of the constant term and the parameters * and let b_i be the coefficients of the variables or constraints * in basis of the tableau. @@ -2303,7 +2343,13 @@ error: /* Given a main tableau where more than one row requires a split, * determine and return the "best" row to split on. * - * Given two rows in the main tableau, if the inequality corresponding + * If any of the rows requiring a split only involves + * variables that also appear in the context tableau, + * then the negative part is guaranteed not to have a solution. + * It is therefore best to split on any of these rows first. + * + * Otherwise, + * given two rows in the main tableau, if the inequality corresponding * to the first row is redundant with respect to that of the second row * in the current tableau, then it is better to split on the second row, * since in the positive part, both rows will be positive. @@ -2347,6 +2393,9 @@ static int best_split(struct isl_tab *tab, struct isl_tab *context_tab) if (tab->row_sign[split] != isl_tab_row_any) continue; + if (is_parametric_constant(tab, split)) + return split; + ineq = get_row_parameter_ineq(tab, split); if (!ineq) return -1; @@ -3660,9 +3709,7 @@ static int is_critical(struct isl_tab *tab, int row) unsigned off = 2 + tab->M; for (j = tab->n_dead; j < tab->n_col; ++j) { - if (tab->col_var[j] >= 0 && - (tab->col_var[j] < tab->n_param || - tab->col_var[j] >= tab->n_var - tab->n_div)) + if (col_is_parameter_var(tab, j)) continue; if (isl_int_is_pos(tab->mat->row[row][off + j])) @@ -4170,10 +4217,7 @@ static void find_solutions_main(struct isl_sol *sol, struct isl_tab *tab) int p; struct isl_vec *eq; - if (tab->row_var[row] < 0) - continue; - if (tab->row_var[row] >= tab->n_param && - tab->row_var[row] < tab->n_var - tab->n_div) + if (!row_is_parameter_var(tab, row)) continue; if (tab->row_var[row] < tab->n_param) p = tab->row_var[row]; @@ -4898,145 +4942,6 @@ static __isl_give isl_basic_set *extract_domain(__isl_keep isl_basic_map *bmap, #define SUFFIX #include "isl_tab_lexopt_templ.c" -struct isl_sol_for { - struct isl_sol sol; - isl_stat (*fn)(__isl_take isl_basic_set *dom, - __isl_take isl_aff_list *list, void *user); - void *user; -}; - -static void sol_for_free(struct isl_sol *sol) -{ -} - -/* Add the solution identified by the tableau and the context tableau. - * In particular, "dom" represents the context and "ma" expresses - * the solution on that context. - * - * See documentation of sol_add for more details. - * - * Instead of constructing a basic map, this function calls a user - * defined function with the current context as a basic set and - * a list of affine expressions representing the relation between - * the input and output. The space over which the affine expressions - * are defined is the same as that of the domain. The number of - * affine expressions in the list is equal to the number of output variables. - */ -static void sol_for_add(struct isl_sol_for *sol, - __isl_take isl_basic_set *dom, __isl_take isl_multi_aff *ma) -{ - int i, n; - isl_ctx *ctx; - isl_aff *aff; - isl_aff_list *list; - - if (sol->sol.error || !dom || !ma) - goto error; - - ctx = isl_basic_set_get_ctx(dom); - n = isl_multi_aff_dim(ma, isl_dim_out); - list = isl_aff_list_alloc(ctx, n); - for (i = 0; i < n; ++i) { - aff = isl_multi_aff_get_aff(ma, i); - list = isl_aff_list_add(list, aff); - } - - dom = isl_basic_set_finalize(dom); - - if (sol->fn(isl_basic_set_copy(dom), list, sol->user) < 0) - goto error; - - isl_basic_set_free(dom); - isl_multi_aff_free(ma); - return; -error: - isl_basic_set_free(dom); - isl_multi_aff_free(ma); - sol->sol.error = 1; -} - -static void sol_for_add_wrap(struct isl_sol *sol, - __isl_take isl_basic_set *dom, __isl_take isl_multi_aff *ma) -{ - sol_for_add((struct isl_sol_for *)sol, dom, ma); -} - -static struct isl_sol_for *sol_for_init(__isl_keep isl_basic_map *bmap, int max, - isl_stat (*fn)(__isl_take isl_basic_set *dom, - __isl_take isl_aff_list *list, void *user), - void *user) -{ - struct isl_sol_for *sol_for = NULL; - isl_space *dom_dim; - struct isl_basic_set *dom = NULL; - - sol_for = isl_calloc_type(bmap->ctx, struct isl_sol_for); - if (!sol_for) - goto error; - - dom_dim = isl_space_domain(isl_space_copy(bmap->dim)); - dom = isl_basic_set_universe(dom_dim); - - sol_for->sol.free = &sol_for_free; - if (sol_init(&sol_for->sol, bmap, dom, max) < 0) - goto error; - sol_for->fn = fn; - sol_for->user = user; - sol_for->sol.add = &sol_for_add_wrap; - sol_for->sol.add_empty = NULL; - - isl_basic_set_free(dom); - return sol_for; -error: - isl_basic_set_free(dom); - sol_free(&sol_for->sol); - return NULL; -} - -static void sol_for_find_solutions(struct isl_sol_for *sol_for, - struct isl_tab *tab) -{ - find_solutions_main(&sol_for->sol, tab); -} - -isl_stat isl_basic_map_foreach_lexopt(__isl_keep isl_basic_map *bmap, int max, - isl_stat (*fn)(__isl_take isl_basic_set *dom, - __isl_take isl_aff_list *list, void *user), - void *user) -{ - struct isl_sol_for *sol_for = NULL; - - bmap = isl_basic_map_copy(bmap); - bmap = isl_basic_map_detect_equalities(bmap); - if (!bmap) - return isl_stat_error; - - sol_for = sol_for_init(bmap, max, fn, user); - if (!sol_for) - goto error; - - if (isl_basic_map_plain_is_empty(bmap)) - /* nothing */; - else { - struct isl_tab *tab; - struct isl_context *context = sol_for->sol.context; - tab = tab_for_lexmin(bmap, - context->op->peek_basic_set(context), 1, max); - tab = context->op->detect_nonnegative_parameters(context, tab); - sol_for_find_solutions(sol_for, tab); - if (sol_for->sol.error) - goto error; - } - - sol_free(&sol_for->sol); - isl_basic_map_free(bmap); - return isl_stat_ok; -error: - sol_free(&sol_for->sol); - isl_basic_map_free(bmap); - return isl_stat_error; -} - /* Extract the subsequence of the sample value of "tab" * starting at "pos" and of length "len". */ @@ -5058,7 +4963,8 @@ static __isl_give isl_vec *extract_sample_sequence(struct isl_tab *tab, int row; row = tab->var[pos + i].index; - isl_int_set(v->el[i], tab->mat->row[row][1]); + isl_int_divexact(v->el[i], tab->mat->row[row][1], + tab->mat->row[row][0]); } } @@ -5093,25 +4999,53 @@ static isl_bool region_is_trivial(struct isl_tab *tab, int pos, return is_trivial; } +/* Global internal data for isl_tab_basic_set_non_trivial_lexmin. + * + * "n_op" is the number of initial coordinates to optimize, + * as passed to isl_tab_basic_set_non_trivial_lexmin. + * "region" is the "n_region"-sized array of regions passed + * to isl_tab_basic_set_non_trivial_lexmin. + * + * "tab" is the tableau that corresponds to the ILP problem. + * "local" is an array of local data structure, one for each + * (potential) level of the backtracking procedure of + * isl_tab_basic_set_non_trivial_lexmin. + * "v" is a pre-allocated vector that can be used for adding + * constraints to the tableau. + * + * "sol" contains the best solution found so far. + * It is initialized to a vector of size zero. + */ +struct isl_lexmin_data { + int n_op; + int n_region; + struct isl_trivial_region *region; + + struct isl_tab *tab; + struct isl_local_region *local; + isl_vec *v; + + isl_vec *sol; +}; + /* Return the index of the first trivial region, "n_region" if all regions * are non-trivial or -1 in case of error. */ -static int first_trivial_region(struct isl_tab *tab, - int n_region, struct isl_trivial_region *region) +static int first_trivial_region(struct isl_lexmin_data *data) { int i; - for (i = 0; i < n_region; ++i) { + for (i = 0; i < data->n_region; ++i) { isl_bool trivial; - trivial = region_is_trivial(tab, region[i].pos, - region[i].trivial); + trivial = region_is_trivial(data->tab, data->region[i].pos, + data->region[i].trivial); if (trivial < 0) return -1; if (trivial) return i; } - return n_region; + return data->n_region; } /* Check if the solution is optimal, i.e., whether the first @@ -5181,22 +5115,13 @@ error: return -1; } -/* Global internal data for isl_tab_basic_set_non_trivial_lexmin. - * - * "v" is a pre-allocated vector that can be used for adding - * constraints to the tableau. - */ -struct isl_trivial_global { - isl_vec *v; -}; - /* Fix triviality direction "dir" of the given region to zero. * * This function assumes that at least two more rows and at least * two more elements in the constraint array are available in the tableau. */ static isl_stat fix_zero(struct isl_tab *tab, struct isl_trivial_region *region, - int dir, struct isl_trivial_global *data) + int dir, struct isl_lexmin_data *data) { int len; @@ -5222,7 +5147,7 @@ static isl_stat fix_zero(struct isl_tab *tab, struct isl_trivial_region *region, */ static struct isl_tab *pos_neg(struct isl_tab *tab, struct isl_trivial_region *region, - int side, struct isl_trivial_global *data) + int side, struct isl_lexmin_data *data) { int len; @@ -5254,8 +5179,10 @@ error: * "region" is the non-triviality region considered at this level. * "side" is the index of the current case at this level. * "n" is the number of triviality directions. + * "snap" is a snapshot of the tableau holding a state that needs + * to be satisfied by all subsequent cases. */ -struct isl_trivial { +struct isl_local_region { int update; int n_zero; int region; @@ -5264,6 +5191,224 @@ struct isl_trivial { struct isl_tab_undo *snap; }; +/* Initialize the global data structure "data" used while solving + * the ILP problem "bset". + */ +static isl_stat init_lexmin_data(struct isl_lexmin_data *data, + __isl_keep isl_basic_set *bset) +{ + isl_ctx *ctx; + + ctx = isl_basic_set_get_ctx(bset); + + data->tab = tab_for_lexmin(bset, NULL, 0, 0); + if (!data->tab) + return isl_stat_error; + + data->v = isl_vec_alloc(ctx, 1 + data->tab->n_var); + if (!data->v) + return isl_stat_error; + data->local = isl_calloc_array(ctx, struct isl_local_region, + data->n_region); + if (data->n_region && !data->local) + return isl_stat_error; + + data->sol = isl_vec_alloc(ctx, 0); + + return isl_stat_ok; +} + +/* Mark all outer levels as requiring a better solution + * in the next cases. + */ +static void update_outer_levels(struct isl_lexmin_data *data, int level) +{ + int i; + + for (i = 0; i < level; ++i) + data->local[i].update = 1; +} + +/* Initialize "local" to refer to region "region" and + * to initiate processing at this level. + */ +static void init_local_region(struct isl_local_region *local, int region, + struct isl_lexmin_data *data) +{ + local->n = isl_mat_rows(data->region[region].trivial); + local->region = region; + local->side = 0; + local->update = 0; + local->n_zero = 0; +} + +/* What to do next after entering a level of the backtracking procedure. + * + * error: some error has occurred; abort + * done: an optimal solution has been found; stop search + * backtrack: backtrack to the previous level + * handle: add the constraints for the current level and + * move to the next level + */ +enum isl_next { + isl_next_error = -1, + isl_next_done, + isl_next_backtrack, + isl_next_handle, +}; + +/* Have all cases of the current region been considered? + * If there are n directions, then there are 2n cases. + * + * The constraints in the current tableau are imposed + * in all subsequent cases. This means that if the current + * tableau is empty, then none of those cases should be considered + * anymore and all cases have effectively been considered. + */ +static int finished_all_cases(struct isl_local_region *local, + struct isl_lexmin_data *data) +{ + if (data->tab->empty) + return 1; + return local->side >= 2 * local->n; +} + +/* Enter level "level" of the backtracking search and figure out + * what to do next. "init" is set if the level was entered + * from a higher level and needs to be initialized. + * Otherwise, the level is entered as a result of backtracking and + * the tableau needs to be restored to a position that can + * be used for the next case at this level. + * The snapshot is assumed to have been saved in the previous case, + * before the constraints specific to that case were added. + * + * In the initialization case, the local region is initialized + * to point to the first violated region. + * If the constraints of all regions are satisfied by the current + * sample of the tableau, then tell the caller to continue looking + * for a better solution or to stop searching if an optimal solution + * has been found. + * + * If the tableau is empty or if all cases at the current level + * have been considered, then the caller needs to backtrack as well. + */ +static enum isl_next enter_level(int level, int init, + struct isl_lexmin_data *data) +{ + struct isl_local_region *local = &data->local[level]; + + if (init) { + int r; + + data->tab = cut_to_integer_lexmin(data->tab, CUT_ONE); + if (!data->tab) + return isl_next_error; + if (data->tab->empty) + return isl_next_backtrack; + r = first_trivial_region(data); + if (r < 0) + return isl_next_error; + if (r == data->n_region) { + update_outer_levels(data, level); + isl_vec_free(data->sol); + data->sol = isl_tab_get_sample_value(data->tab); + if (!data->sol) + return isl_next_error; + if (is_optimal(data->sol, data->n_op)) + return isl_next_done; + return isl_next_backtrack; + } + if (level >= data->n_region) + isl_die(isl_vec_get_ctx(data->v), isl_error_internal, + "nesting level too deep", + return isl_next_error); + init_local_region(local, r, data); + if (isl_tab_extend_cons(data->tab, + 2 * local->n + 2 * data->n_op) < 0) + return isl_next_error; + } else { + if (isl_tab_rollback(data->tab, local->snap) < 0) + return isl_next_error; + } + + if (finished_all_cases(local, data)) + return isl_next_backtrack; + return isl_next_handle; +} + +/* If a solution has been found in the previous case at this level + * (marked by local->update being set), then add constraints + * that enforce a better solution in the present and all following cases. + * The constraints only need to be imposed once because they are + * included in the snapshot (taken in pick_side) that will be used in + * subsequent cases. + */ +static isl_stat better_next_side(struct isl_local_region *local, + struct isl_lexmin_data *data) +{ + if (!local->update) + return isl_stat_ok; + + local->n_zero = force_better_solution(data->tab, + data->sol, data->n_op, local->n_zero); + if (local->n_zero < 0) + return isl_stat_error; + + local->update = 0; + + return isl_stat_ok; +} + +/* Add constraints to data->tab that select the current case (local->side) + * at the current level. + * + * If the linear combinations v should not be zero, then the cases are + * v_0 >= 1 + * v_0 <= -1 + * v_0 = 0 and v_1 >= 1 + * v_0 = 0 and v_1 <= -1 + * v_0 = 0 and v_1 = 0 and v_2 >= 1 + * v_0 = 0 and v_1 = 0 and v_2 <= -1 + * ... + * in this order. + * + * A snapshot is taken after the equality constraint (if any) has been added + * such that the next case can start off from this position. + * The rollback to this position is performed in enter_level. + */ +static isl_stat pick_side(struct isl_local_region *local, + struct isl_lexmin_data *data) +{ + struct isl_trivial_region *region; + int side, base; + + region = &data->region[local->region]; + side = local->side; + base = 2 * (side/2); + + if (side == base && base >= 2 && + fix_zero(data->tab, region, base / 2 - 1, data) < 0) + return isl_stat_error; + + local->snap = isl_tab_snap(data->tab); + if (isl_tab_push_basis(data->tab) < 0) + return isl_stat_error; + + data->tab = pos_neg(data->tab, region, side, data); + if (!data->tab) + return isl_stat_error; + return isl_stat_ok; +} + +/* Free the memory associated to "data". + */ +static void clear_lexmin_data(struct isl_lexmin_data *data) +{ + free(data->local); + isl_vec_free(data->v); + isl_tab_free(data->tab); +} + /* Return the lexicographically smallest non-trivial solution of the * given ILP problem. * @@ -5305,122 +5450,53 @@ __isl_give isl_vec *isl_tab_basic_set_non_trivial_lexmin( struct isl_trivial_region *region, int (*conflict)(int con, void *user), void *user) { - struct isl_trivial_global data = { 0 }; - int i; - int r; - isl_ctx *ctx; - isl_vec *sol = NULL; - struct isl_tab *tab; - struct isl_trivial *triv = NULL; + struct isl_lexmin_data data = { n_op, n_region, region }; int level, init; if (!bset) return NULL; - ctx = isl_basic_set_get_ctx(bset); - sol = isl_vec_alloc(ctx, 0); - - tab = tab_for_lexmin(bset, NULL, 0, 0); - if (!tab) - goto error; - tab->conflict = conflict; - tab->conflict_user = user; - - data.v = isl_vec_alloc(ctx, 1 + tab->n_var); - triv = isl_calloc_array(ctx, struct isl_trivial, n_region); - if (!data.v || (n_region && !triv)) + if (init_lexmin_data(&data, bset) < 0) goto error; + data.tab->conflict = conflict; + data.tab->conflict_user = user; level = 0; init = 1; while (level >= 0) { - int side, base; + enum isl_next next; + struct isl_local_region *local = &data.local[level]; - if (init) { - tab = cut_to_integer_lexmin(tab, CUT_ONE); - if (!tab) - goto error; - if (tab->empty) - goto backtrack; - r = first_trivial_region(tab, n_region, region); - if (r < 0) - goto error; - if (r == n_region) { - for (i = 0; i < level; ++i) - triv[i].update = 1; - isl_vec_free(sol); - sol = isl_tab_get_sample_value(tab); - if (!sol) - goto error; - if (is_optimal(sol, n_op)) - break; - goto backtrack; - } - if (level >= n_region) - isl_die(ctx, isl_error_internal, - "nesting level too deep", goto error); - triv[level].n = isl_mat_rows(region[r].trivial); - if (isl_tab_extend_cons(tab, - 2 * triv[level].n + 2 * n_op) < 0) - goto error; - triv[level].region = r; - triv[level].side = 0; - triv[level].update = 0; - triv[level].n_zero = 0; - } - - r = triv[level].region; - side = triv[level].side; - base = 2 * (side/2); - - if (side >= 2 * triv[level].n) { -backtrack: + next = enter_level(level, init, &data); + if (next < 0) + goto error; + if (next == isl_next_done) + break; + if (next == isl_next_backtrack) { level--; init = 0; - if (level >= 0) - if (isl_tab_rollback(tab, triv[level].snap) < 0) - goto error; continue; } - if (triv[level].update) { - triv[level].n_zero = force_better_solution(tab, sol, - n_op, triv[level].n_zero); - if (triv[level].n_zero < 0) - goto error; - triv[level].update = 0; - } - - if (side == base && base >= 2 && - fix_zero(tab, ®ion[r], base / 2 - 1, &data) < 0) + if (better_next_side(local, &data) < 0) + goto error; + if (pick_side(local, &data) < 0) goto error; - triv[level].snap = isl_tab_snap(tab); - if (isl_tab_push_basis(tab) < 0) - goto error; - - tab = pos_neg(tab, ®ion[r], side, &data); - if (!tab) - goto error; - - triv[level].side++; + local->side++; level++; init = 1; } - free(triv); - isl_vec_free(data.v); - isl_tab_free(tab); + clear_lexmin_data(&data); isl_basic_set_free(bset); - return sol; + return data.sol; error: - free(triv); - isl_vec_free(data.v); - isl_tab_free(tab); + clear_lexmin_data(&data); isl_basic_set_free(bset); - isl_vec_free(sol); + isl_vec_free(data.sol); return NULL; } diff --git a/polly/lib/External/isl/isl_test.c b/polly/lib/External/isl/isl_test.c index 2773be51dd0f..a3dc545ad637 100644 --- a/polly/lib/External/isl/isl_test.c +++ b/polly/lib/External/isl/isl_test.c @@ -331,37 +331,28 @@ static int test_bounded(isl_ctx *ctx) /* Construct the basic set { [i] : 5 <= i <= N } */ static int test_construction_1(isl_ctx *ctx) { - isl_int v; isl_space *dim; isl_local_space *ls; isl_basic_set *bset; isl_constraint *c; - isl_int_init(v); - dim = isl_space_set_alloc(ctx, 1, 1); bset = isl_basic_set_universe(isl_space_copy(dim)); ls = isl_local_space_from_space(dim); c = isl_constraint_alloc_inequality(isl_local_space_copy(ls)); - isl_int_set_si(v, -1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, 1); - c = isl_constraint_set_coefficient(c, isl_dim_param, 0, v); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1); + c = isl_constraint_set_coefficient_si(c, isl_dim_param, 0, 1); bset = isl_basic_set_add_constraint(bset, c); c = isl_constraint_alloc_inequality(isl_local_space_copy(ls)); - isl_int_set_si(v, 1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, -5); - c = isl_constraint_set_constant(c, v); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1); + c = isl_constraint_set_constant_si(c, -5); bset = isl_basic_set_add_constraint(bset, c); isl_local_space_free(ls); isl_basic_set_free(bset); - isl_int_clear(v); - return 0; } @@ -515,14 +506,17 @@ static int test_un_val(isl_ctx *ctx) int i; isl_val *v, *res; __isl_give isl_val *(*fn)(__isl_take isl_val *v); - int ok; + isl_bool ok, is_nan; for (i = 0; i < ARRAY_SIZE(val_un_tests); ++i) { v = isl_val_read_from_str(ctx, val_un_tests[i].arg); res = isl_val_read_from_str(ctx, val_un_tests[i].res); fn = val_un_tests[i].op; v = fn(v); - if (isl_val_is_nan(res)) + is_nan = isl_val_is_nan(res); + if (is_nan < 0) + ok = isl_bool_error; + else if (is_nan) ok = isl_val_is_nan(v); else ok = isl_val_eq(v, res); @@ -714,36 +708,27 @@ static int test_div(isl_ctx *ctx) { const char *str; int empty; - isl_int v; isl_space *dim; isl_set *set; isl_local_space *ls; struct isl_basic_set *bset; struct isl_constraint *c; - isl_int_init(v); - /* test 1 */ dim = isl_space_set_alloc(ctx, 0, 3); bset = isl_basic_set_universe(isl_space_copy(dim)); ls = isl_local_space_from_space(dim); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, -1); - c = isl_constraint_set_constant(c, v); - isl_int_set_si(v, 1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, 3); - c = isl_constraint_set_coefficient(c, isl_dim_set, 1, v); + c = isl_constraint_set_constant_si(c, -1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 3); bset = isl_basic_set_add_constraint(bset, c); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, 1); - c = isl_constraint_set_constant(c, v); - isl_int_set_si(v, -1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, 3); - c = isl_constraint_set_coefficient(c, isl_dim_set, 2, v); + c = isl_constraint_set_constant_si(c, 1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 2, 3); bset = isl_basic_set_add_constraint(bset, c); bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 2); @@ -758,21 +743,15 @@ static int test_div(isl_ctx *ctx) ls = isl_local_space_from_space(dim); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, 1); - c = isl_constraint_set_constant(c, v); - isl_int_set_si(v, -1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, 3); - c = isl_constraint_set_coefficient(c, isl_dim_set, 1, v); + c = isl_constraint_set_constant_si(c, 1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 3); bset = isl_basic_set_add_constraint(bset, c); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, -1); - c = isl_constraint_set_constant(c, v); - isl_int_set_si(v, 1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, 3); - c = isl_constraint_set_coefficient(c, isl_dim_set, 2, v); + c = isl_constraint_set_constant_si(c, -1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 2, 3); bset = isl_basic_set_add_constraint(bset, c); bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 2); @@ -787,21 +766,15 @@ static int test_div(isl_ctx *ctx) ls = isl_local_space_from_space(dim); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, 1); - c = isl_constraint_set_constant(c, v); - isl_int_set_si(v, -1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, 3); - c = isl_constraint_set_coefficient(c, isl_dim_set, 1, v); + c = isl_constraint_set_constant_si(c, 1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 3); bset = isl_basic_set_add_constraint(bset, c); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, -3); - c = isl_constraint_set_constant(c, v); - isl_int_set_si(v, 1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, 4); - c = isl_constraint_set_coefficient(c, isl_dim_set, 2, v); + c = isl_constraint_set_constant_si(c, -3); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 2, 4); bset = isl_basic_set_add_constraint(bset, c); bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 2); @@ -816,21 +789,15 @@ static int test_div(isl_ctx *ctx) ls = isl_local_space_from_space(dim); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, 2); - c = isl_constraint_set_constant(c, v); - isl_int_set_si(v, -1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, 3); - c = isl_constraint_set_coefficient(c, isl_dim_set, 1, v); + c = isl_constraint_set_constant_si(c, 2); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 3); bset = isl_basic_set_add_constraint(bset, c); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, -1); - c = isl_constraint_set_constant(c, v); - isl_int_set_si(v, 1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, 6); - c = isl_constraint_set_coefficient(c, isl_dim_set, 2, v); + c = isl_constraint_set_constant_si(c, -1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 2, 6); bset = isl_basic_set_add_constraint(bset, c); bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 2); @@ -845,17 +812,13 @@ static int test_div(isl_ctx *ctx) ls = isl_local_space_from_space(dim); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, -1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, 3); - c = isl_constraint_set_coefficient(c, isl_dim_set, 2, v); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 2, 3); bset = isl_basic_set_add_constraint(bset, c); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, 1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, -3); - c = isl_constraint_set_coefficient(c, isl_dim_set, 1, v); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, -3); bset = isl_basic_set_add_constraint(bset, c); bset = isl_basic_set_project_out(bset, isl_dim_set, 2, 1); @@ -870,17 +833,13 @@ static int test_div(isl_ctx *ctx) ls = isl_local_space_from_space(dim); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, -1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, 6); - c = isl_constraint_set_coefficient(c, isl_dim_set, 2, v); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 2, 6); bset = isl_basic_set_add_constraint(bset, c); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, 1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, -3); - c = isl_constraint_set_coefficient(c, isl_dim_set, 1, v); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, -3); bset = isl_basic_set_add_constraint(bset, c); bset = isl_basic_set_project_out(bset, isl_dim_set, 2, 1); @@ -904,14 +863,10 @@ static int test_div(isl_ctx *ctx) ls = isl_local_space_from_space(dim); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, -1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, -3); - c = isl_constraint_set_coefficient(c, isl_dim_set, 1, v); - isl_int_set_si(v, -3); - c = isl_constraint_set_coefficient(c, isl_dim_set, 2, v); - isl_int_set_si(v, 6); - c = isl_constraint_set_coefficient(c, isl_dim_set, 3, v); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, -3); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 2, -3); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 3, 6); bset = isl_basic_set_add_constraint(bset, c); bset = isl_basic_set_project_out(bset, isl_dim_set, 3, 1); @@ -929,23 +884,16 @@ static int test_div(isl_ctx *ctx) ls = isl_local_space_from_space(dim); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, -1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, -3); - c = isl_constraint_set_coefficient(c, isl_dim_set, 1, v); - isl_int_set_si(v, -3); - c = isl_constraint_set_coefficient(c, isl_dim_set, 3, v); - isl_int_set_si(v, 6); - c = isl_constraint_set_coefficient(c, isl_dim_set, 4, v); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, -3); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 3, -3); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 4, 6); bset = isl_basic_set_add_constraint(bset, c); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, -1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, 1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 2, v); - isl_int_set_si(v, 1); - c = isl_constraint_set_constant(c, v); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 2, 1); + c = isl_constraint_set_constant_si(c, 1); bset = isl_basic_set_add_constraint(bset, c); bset = isl_basic_set_project_out(bset, isl_dim_set, 4, 1); @@ -963,21 +911,15 @@ static int test_div(isl_ctx *ctx) ls = isl_local_space_from_space(dim); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, 1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, -1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 1, v); - isl_int_set_si(v, -2); - c = isl_constraint_set_coefficient(c, isl_dim_set, 2, v); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, -1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 2, -2); bset = isl_basic_set_add_constraint(bset, c); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, -1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, 3); - c = isl_constraint_set_coefficient(c, isl_dim_set, 3, v); - isl_int_set_si(v, 2); - c = isl_constraint_set_constant(c, v); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 3, 3); + c = isl_constraint_set_constant_si(c, 2); bset = isl_basic_set_add_constraint(bset, c); bset = isl_basic_set_project_out(bset, isl_dim_set, 2, 2); @@ -995,10 +937,8 @@ static int test_div(isl_ctx *ctx) ls = isl_local_space_from_space(dim); c = isl_constraint_alloc_equality(isl_local_space_copy(ls)); - isl_int_set_si(v, 1); - c = isl_constraint_set_coefficient(c, isl_dim_set, 0, v); - isl_int_set_si(v, -2); - c = isl_constraint_set_coefficient(c, isl_dim_set, 2, v); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1); + c = isl_constraint_set_coefficient_si(c, isl_dim_set, 2, -2); bset = isl_basic_set_add_constraint(bset, c); bset = isl_basic_set_project_out(bset, isl_dim_set, 2, 1); @@ -1008,8 +948,6 @@ static int test_div(isl_ctx *ctx) isl_local_space_free(ls); isl_basic_set_free(bset); - isl_int_clear(v); - str = "{ [i] : exists (e0, e1: 3e1 >= 1 + 2e0 and " "8e1 <= -1 + 5i - 5e0 and 2e1 >= 1 + 2i - 5e0) }"; set = isl_set_read_from_str(ctx, str); @@ -1948,6 +1886,11 @@ struct { "2e0 < -a + 2b) }" }, { 1, "{ [i, j, i - 8j] : 8 <= i <= 63 and -7 + i <= 8j <= i; " "[i, 0, i] : 0 <= i <= 7 }" }, + { 1, "{ [a, b] : a >= 0 and 0 <= b <= 1 - a; [1, 1] }" }, + { 0, "{ [a, b] : a >= 0 and 0 <= b <= 1 - a; [0, 2] }" }, + { 0, "{ [a, b] : a >= 0 and 0 <= b <= 1 - a; [-1, 3] }" }, + { 1, "{ [a, b] : a, b >= 0 and a + 2b <= 2; [1, 1] }" }, + { 0, "{ [a, b] : a, b >= 0 and a + 2b <= 2; [2, 1] }" }, }; /* A specialized coalescing test case that would result @@ -3640,8 +3583,8 @@ int test_special_schedule(isl_ctx *ctx, const char *domain, return 0; } -/* Check that the schedule map is properly padded, even after being - * reconstructed from the band forest. +/* Check that the schedule map is properly padded, i.e., that the range + * lives in a single space. */ static int test_padded_schedule(isl_ctx *ctx) { @@ -3650,9 +3593,9 @@ static int test_padded_schedule(isl_ctx *ctx) isl_union_map *validity, *proximity; isl_schedule_constraints *sc; isl_schedule *sched; - isl_union_map *map1, *map2; - isl_band_list *list; - int equal; + isl_union_map *umap; + isl_union_set *range; + isl_set *set; str = "[N] -> { S0[i] : 0 <= i <= N; S1[i, j] : 0 <= i, j <= N }"; D = isl_union_set_read_from_str(ctx, str); @@ -3662,21 +3605,14 @@ static int test_padded_schedule(isl_ctx *ctx) sc = isl_schedule_constraints_set_validity(sc, validity); sc = isl_schedule_constraints_set_proximity(sc, proximity); sched = isl_schedule_constraints_compute_schedule(sc); - map1 = isl_schedule_get_map(sched); - list = isl_schedule_get_band_forest(sched); - isl_band_list_free(list); - map2 = isl_schedule_get_map(sched); + umap = isl_schedule_get_map(sched); isl_schedule_free(sched); - equal = isl_union_map_is_equal(map1, map2); - isl_union_map_free(map1); - isl_union_map_free(map2); + range = isl_union_map_range(umap); + set = isl_set_from_union_set(range); + isl_set_free(set); - if (equal < 0) + if (!set) return -1; - if (!equal) - isl_die(ctx, isl_error_unknown, - "reconstructed schedule map not the same as original", - return -1); return 0; } @@ -4094,8 +4030,8 @@ static int test_bounded_coefficients_schedule_whole(isl_ctx *ctx) sched1 = isl_schedule_get_map(schedule); isl_schedule_free(schedule); - str = "{ S_4[i, j, k] -> [i, j, 10 - k, 1]; " - "S_2[i, j] -> [0, i, j, 0]; S_6[i, j] -> [0, 10 + i, j, 2] }"; + str = "{ S_4[i, j, k] -> [i, j, 10 - k]; " + "S_2[i, j] -> [0, i, j]; S_6[i, j] -> [0, 10 + i, j] }"; sched2 = isl_union_map_read_from_str(ctx, str); equal = isl_union_map_is_equal(sched1, sched2); isl_union_map_free(sched1); @@ -4586,6 +4522,82 @@ static int aff_check_plain_equal(__isl_keep isl_aff *aff, const char *str) return 0; } +/* Is "upa" obviously equal to the isl_union_pw_aff represented by "str"? + */ +static isl_bool union_pw_aff_plain_is_equal(__isl_keep isl_union_pw_aff *upa, + const char *str) +{ + isl_ctx *ctx; + isl_union_pw_aff *upa2; + isl_bool equal; + + if (!upa) + return isl_bool_error; + + ctx = isl_union_pw_aff_get_ctx(upa); + upa2 = isl_union_pw_aff_read_from_str(ctx, str); + equal = isl_union_pw_aff_plain_is_equal(upa, upa2); + isl_union_pw_aff_free(upa2); + + return equal; +} + +/* Check that "upa" is obviously equal to the isl_union_pw_aff + * represented by "str". + */ +static isl_stat union_pw_aff_check_plain_equal(__isl_keep isl_union_pw_aff *upa, + const char *str) +{ + isl_bool equal; + + equal = union_pw_aff_plain_is_equal(upa, str); + if (equal < 0) + return isl_stat_error; + if (!equal) + isl_die(isl_union_pw_aff_get_ctx(upa), isl_error_unknown, + "result not as expected", return isl_stat_error); + return isl_stat_ok; +} + +/* Basic tests on isl_union_pw_aff. + * + * In particular, check that isl_union_pw_aff_aff_on_domain + * aligns the parameters of the input objects and + * that isl_union_pw_aff_param_on_domain_id properly + * introduces the parameter. + */ +static int test_upa(isl_ctx *ctx) +{ + const char *str; + isl_id *id; + isl_aff *aff; + isl_union_set *domain; + isl_union_pw_aff *upa; + isl_stat ok; + + aff = isl_aff_read_from_str(ctx, "[N] -> { [N] }"); + str = "[M] -> { A[i] : 0 <= i < M; B[] }"; + domain = isl_union_set_read_from_str(ctx, str); + upa = isl_union_pw_aff_aff_on_domain(domain, aff); + str = "[N, M] -> { A[i] -> [N] : 0 <= i < M; B[] -> [N] }"; + ok = union_pw_aff_check_plain_equal(upa, str); + isl_union_pw_aff_free(upa); + if (ok < 0) + return -1; + + id = isl_id_alloc(ctx, "N", NULL); + str = "[M] -> { A[i] : 0 <= i < M; B[] }"; + domain = isl_union_set_read_from_str(ctx, str); + upa = isl_union_pw_aff_param_on_domain_id(domain, id); + str = "[N, M] -> { A[i] -> [N] : 0 <= i < M; B[] -> [N] }"; + ok = union_pw_aff_check_plain_equal(upa, str); + isl_union_pw_aff_free(upa); + if (ok < 0) + return -1; + + return 0; +} + struct { __isl_give isl_aff *(*fn)(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); @@ -4830,6 +4842,56 @@ static int test_bin_upma_fail(isl_ctx *ctx) return 0; } +/* Inputs for basic tests of binary operations on + * pairs of isl_multi_union_pw_aff and isl_union_set objects. + * "fn" is the function that is tested. + * "arg1" and "arg2" are string descriptions of the inputs. + * "res" is a string description of the expected result. + */ +struct { + __isl_give isl_multi_union_pw_aff *(*fn)( + __isl_take isl_multi_union_pw_aff *mupa, + __isl_take isl_union_set *uset); + const char *arg1; + const char *arg2; + const char *res; +} mupa_uset_tests[] = { + { &isl_multi_union_pw_aff_intersect_domain, + "C[{ B[i,j] -> [i + 2j] }]", "{ B[i,i] }", + "C[{ B[i,i] -> [3i] }]" }, +}; + +/* Perform some basic tests of binary operations on + * pairs of isl_multi_union_pw_aff and isl_union_set objects. + */ +static int test_mupa_uset(isl_ctx *ctx) +{ + int i; + isl_bool ok; + isl_multi_union_pw_aff *mupa, *res; + isl_union_set *uset; + + for (i = 0; i < ARRAY_SIZE(mupa_uset_tests); ++i) { + mupa = isl_multi_union_pw_aff_read_from_str(ctx, + mupa_uset_tests[i].arg1); + uset = isl_union_set_read_from_str(ctx, + mupa_uset_tests[i].arg2); + res = isl_multi_union_pw_aff_read_from_str(ctx, + mupa_uset_tests[i].res); + mupa = mupa_uset_tests[i].fn(mupa, uset); + ok = isl_multi_union_pw_aff_plain_is_equal(mupa, res); + isl_multi_union_pw_aff_free(mupa); + isl_multi_union_pw_aff_free(res); + if (ok < 0) + return -1; + if (!ok) + isl_die(ctx, isl_error_unknown, + "unexpected result", return -1); + } + + return 0; +} + int test_aff(isl_ctx *ctx) { const char *str; @@ -4839,6 +4901,8 @@ int test_aff(isl_ctx *ctx) isl_aff *aff; int zero, equal; + if (test_upa(ctx) < 0) + return -1; if (test_bin_aff(ctx) < 0) return -1; if (test_bin_pw_aff(ctx) < 0) @@ -4847,6 +4911,8 @@ int test_aff(isl_ctx *ctx) return -1; if (test_bin_upma_fail(ctx) < 0) return -1; + if (test_mupa_uset(ctx) < 0) + return -1; space = isl_space_set_alloc(ctx, 0, 1); ls = isl_local_space_from_space(space); @@ -4884,23 +4950,12 @@ int test_aff(isl_ctx *ctx) return 0; } -/* Check that the computation below results in a single expression. - * One or two expressions may result depending on which constraint - * ends up being considered as redundant with respect to the other - * constraints after the projection that is performed internally - * by isl_set_dim_min. +/* Check that "pa" consists of a single expression. */ -static int test_dim_max_1(isl_ctx *ctx) +static int check_single_piece(isl_ctx *ctx, __isl_take isl_pw_aff *pa) { - const char *str; - isl_set *set; - isl_pw_aff *pa; int n; - str = "[n] -> { [a, b] : n >= 0 and 4a >= -4 + n and b >= 0 and " - "-4a <= b <= 3 and b < n - 4a }"; - set = isl_set_read_from_str(ctx, str); - pa = isl_set_dim_min(set, 0); n = isl_pw_aff_n_piece(pa); isl_pw_aff_free(pa); @@ -4913,6 +4968,47 @@ static int test_dim_max_1(isl_ctx *ctx) return 0; } +/* Check that the computation below results in a single expression. + * One or two expressions may result depending on which constraint + * ends up being considered as redundant with respect to the other + * constraints after the projection that is performed internally + * by isl_set_dim_min. + */ +static int test_dim_max_1(isl_ctx *ctx) +{ + const char *str; + isl_set *set; + isl_pw_aff *pa; + + str = "[n] -> { [a, b] : n >= 0 and 4a >= -4 + n and b >= 0 and " + "-4a <= b <= 3 and b < n - 4a }"; + set = isl_set_read_from_str(ctx, str); + pa = isl_set_dim_min(set, 0); + return check_single_piece(ctx, pa); +} + +/* Check that the computation below results in a single expression. + * The PIP problem corresponding to these constraints has a row + * that causes a split of the solution domain. The solver should + * first pick rows that split off empty parts such that the actual + * solution domain does not get split. + * Note that the description contains some redundant constraints. + * If these constraints get removed first, then the row mentioned + * above does not appear in the PIP problem. + */ +static int test_dim_max_2(isl_ctx *ctx) +{ + const char *str; + isl_set *set; + isl_pw_aff *pa; + + str = "[P, N] -> { [a] : a < N and a >= 0 and N > P and a <= P and " + "N > 0 and P >= 0 }"; + set = isl_set_read_from_str(ctx, str); + pa = isl_set_dim_max(set, 0); + return check_single_piece(ctx, pa); +} + int test_dim_max(isl_ctx *ctx) { int equal; @@ -4924,6 +5020,8 @@ int test_dim_max(isl_ctx *ctx) if (test_dim_max_1(ctx) < 0) return -1; + if (test_dim_max_2(ctx) < 0) + return -1; str = "[N] -> { [i] : 0 <= i <= min(N,10) }"; set = isl_set_read_from_str(ctx, str); @@ -5440,6 +5538,16 @@ static int test_eval(isl_ctx *ctx) */ const char *output_tests[] = { "{ [1, y] : 0 <= y <= 1; [x, -x] : 0 <= x <= 1 }", + "{ [x] : 1 = 0 }", + "{ [x] : false }", + "{ [x] : x mod 2 = 0 }", + "{ [x] : x mod 2 = 1 }", + "{ [x, y] : x mod 2 = 0 and 3*floor(y/2) < x }", + "{ [y, x] : x mod 2 = 0 and 3*floor(y/2) < x }", + "{ [x, y] : x mod 2 = 0 and 3*floor(y/2) = x + y }", + "{ [y, x] : x mod 2 = 0 and 3*floor(y/2) = x + y }", + "[n] -> { [y, x] : 2*((x + 2y) mod 3) = n }", + "{ [x, y] : (2*floor(x/3) + 3*floor(y/4)) mod 5 = x }", }; /* Check that printing a set and reparsing a set from the printed output @@ -5555,16 +5663,14 @@ int test_fixed_power(isl_ctx *ctx) { const char *str; isl_map *map; - isl_int exp; + isl_val *exp; int equal; - isl_int_init(exp); str = "{ [i] -> [i + 1] }"; map = isl_map_read_from_str(ctx, str); - isl_int_set_si(exp, 23); - map = isl_map_fixed_power(map, exp); + exp = isl_val_int_from_si(ctx, 23); + map = isl_map_fixed_power_val(map, exp); equal = map_check_equal(map, "{ [i] -> [i + 23] }"); - isl_int_clear(exp); isl_map_free(map); if (equal < 0) return -1; @@ -5723,6 +5829,8 @@ static int test_list(isl_ctx *ctx) list = isl_id_list_add(list, d); list = isl_id_list_drop(list, 1, 1); + if (!list) + return -1; if (isl_id_list_n_id(list) != 3) { isl_id_list_free(list); isl_die(ctx, isl_error_unknown, diff --git a/polly/lib/External/isl/isl_union_map.c b/polly/lib/External/isl/isl_union_map.c index a5ae13546632..caccf04e6c4d 100644 --- a/polly/lib/External/isl/isl_union_map.c +++ b/polly/lib/External/isl/isl_union_map.c @@ -24,11 +24,11 @@ #include #include #include -#include #include #include #include +#include /* Return the number of parameters of "umap", where "type" * is required to be set to isl_dim_param. @@ -111,14 +111,14 @@ static __isl_give isl_union_map *isl_union_map_alloc( return umap; } -__isl_give isl_union_map *isl_union_map_empty(__isl_take isl_space *dim) +__isl_give isl_union_map *isl_union_map_empty(__isl_take isl_space *space) { - return isl_union_map_alloc(dim, 16); + return isl_union_map_alloc(space, 16); } -__isl_give isl_union_set *isl_union_set_empty(__isl_take isl_space *dim) +__isl_give isl_union_set *isl_union_set_empty(__isl_take isl_space *space) { - return isl_union_map_empty(dim); + return isl_union_map_empty(space); } isl_ctx *isl_union_map_get_ctx(__isl_keep isl_union_map *umap) @@ -349,6 +349,14 @@ isl_bool isl_union_map_space_has_equal_params(__isl_keep isl_union_map *umap, return isl_space_has_equal_params(umap_space, space); } +/* Do "uset" and "space" have the same parameters? + */ +isl_bool isl_union_set_space_has_equal_params(__isl_keep isl_union_set *uset, + __isl_keep isl_space *space) +{ + return isl_union_map_space_has_equal_params(uset_to_umap(uset), space); +} + static int has_space(const void *entry, const void *val) { isl_map *map = (isl_map *)entry; @@ -483,6 +491,58 @@ isl_stat isl_union_map_foreach_map(__isl_keep isl_union_map *umap, &call_on_copy, &data); } +/* Internal data structure for isl_union_map_every_map. + * + * "test" is the user-specified callback function. + * "user" is the user-specified callback function argument. + * + * "failed" is initialized to 0 and set to 1 if "test" fails + * on any map. + */ +struct isl_union_map_every_data { + isl_bool (*test)(__isl_keep isl_map *map, void *user); + void *user; + int failed; +}; + +/* Call data->test on "map". + * If this fails, then set data->failed and abort. + */ +static isl_stat call_every(void **entry, void *user) +{ + isl_map *map = *entry; + struct isl_union_map_every_data *data = user; + isl_bool r; + + r = data->test(map, data->user); + if (r < 0) + return isl_stat_error; + if (r) + return isl_stat_ok; + data->failed = 1; + return isl_stat_error; +} + +/* Does "test" succeed on every map in "umap"? + */ +isl_bool isl_union_map_every_map(__isl_keep isl_union_map *umap, + isl_bool (*test)(__isl_keep isl_map *map, void *user), void *user) +{ + struct isl_union_map_every_data data = { test, user, 0 }; + isl_stat r; + + if (!umap) + return isl_bool_error; + + r = isl_hash_table_foreach(isl_union_map_get_ctx(umap), &umap->table, + &call_every, &data); + if (r >= 0) + return isl_bool_true; + if (data.failed) + return isl_bool_false; + return isl_bool_error; +} + static isl_stat copy_map(void **entry, void *user) { isl_map *map = *entry; @@ -1518,7 +1578,8 @@ __isl_give isl_union_map *isl_union_map_flat_range_product( * the results need to live in the same space. * Otherwise, a new union map is constructed to store the results. * If "filter" is not NULL, then only the input maps that satisfy "filter" - * are taken into account. No filter can be set if "inplace" or + * are taken into account. "filter_user" is passed as the second argument + * to "filter". No filter can be set if "inplace" or * "total" is set. * "fn_map" specifies how the maps (selected by "filter") * should be transformed. @@ -1526,10 +1587,28 @@ __isl_give isl_union_map *isl_union_map_flat_range_product( struct isl_un_op_control { int inplace; int total; - isl_bool (*filter)(__isl_keep isl_map *map); + isl_bool (*filter)(__isl_keep isl_map *map, void *user); + void *filter_user; __isl_give isl_map *(*fn_map)(__isl_take isl_map *map); }; +/* Data structure for wrapping the data for un_op_filter_drop_user. + * "filter" is the function that is being wrapped. + */ +struct isl_un_op_drop_user_data { + isl_bool (*filter)(__isl_keep isl_map *map); +}; + +/* Wrapper for isl_un_op_control filters that do not require + * a second argument. + * Simply call data->filter without the second argument. + */ +static isl_bool un_op_filter_drop_user(__isl_keep isl_map *map, void *user) +{ + struct isl_un_op_drop_user_data *data = user; + return data->filter(map); +} + /* Internal data structure for "un_op". * "control" specifies how the maps in the union map should be modified. * "res" collects the results. @@ -1555,7 +1634,7 @@ static isl_stat un_entry(void **entry, void *user) if (data->control->filter) { isl_bool ok; - ok = data->control->filter(map); + ok = data->control->filter(map, data->control->filter_user); if (ok < 0) return isl_stat_error; if (!ok) @@ -1958,8 +2037,10 @@ __isl_give isl_union_map *isl_union_map_range_map( __isl_give isl_union_map *isl_union_set_wrapped_domain_map( __isl_take isl_union_set *uset) { + struct isl_un_op_drop_user_data data = { &isl_set_is_wrapping }; struct isl_un_op_control control = { - .filter = &isl_set_is_wrapping, + .filter = &un_op_filter_drop_user, + .filter_user = &data, .fn_map = &isl_set_wrapped_domain_map, }; return un_op(uset, &control); @@ -1967,7 +2048,7 @@ __isl_give isl_union_map *isl_union_set_wrapped_domain_map( /* Does "map" relate elements from the same space? */ -static isl_bool equal_tuples(__isl_keep isl_map *map) +static isl_bool equal_tuples(__isl_keep isl_map *map, void *user) { return isl_space_tuple_is_equal(map->dim, isl_dim_in, map->dim, isl_dim_out); @@ -2038,8 +2119,10 @@ __isl_give isl_union_pw_multi_aff *isl_union_set_identity_union_pw_multi_aff( __isl_give isl_union_map *isl_union_map_domain_factor_domain( __isl_take isl_union_map *umap) { + struct isl_un_op_drop_user_data data = { &isl_map_domain_is_wrapping }; struct isl_un_op_control control = { - .filter = &isl_map_domain_is_wrapping, + .filter = &un_op_filter_drop_user, + .filter_user = &data, .fn_map = &isl_map_domain_factor_domain, }; return un_op(umap, &control); @@ -2051,8 +2134,10 @@ __isl_give isl_union_map *isl_union_map_domain_factor_domain( __isl_give isl_union_map *isl_union_map_domain_factor_range( __isl_take isl_union_map *umap) { + struct isl_un_op_drop_user_data data = { &isl_map_domain_is_wrapping }; struct isl_un_op_control control = { - .filter = &isl_map_domain_is_wrapping, + .filter = &un_op_filter_drop_user, + .filter_user = &data, .fn_map = &isl_map_domain_factor_range, }; return un_op(umap, &control); @@ -2064,8 +2149,10 @@ __isl_give isl_union_map *isl_union_map_domain_factor_range( __isl_give isl_union_map *isl_union_map_range_factor_domain( __isl_take isl_union_map *umap) { + struct isl_un_op_drop_user_data data = { &isl_map_range_is_wrapping }; struct isl_un_op_control control = { - .filter = &isl_map_range_is_wrapping, + .filter = &un_op_filter_drop_user, + .filter_user = &data, .fn_map = &isl_map_range_factor_domain, }; return un_op(umap, &control); @@ -2077,8 +2164,10 @@ __isl_give isl_union_map *isl_union_map_range_factor_domain( __isl_give isl_union_map *isl_union_map_range_factor_range( __isl_take isl_union_map *umap) { + struct isl_un_op_drop_user_data data = { &isl_map_range_is_wrapping }; struct isl_un_op_control control = { - .filter = &isl_map_range_is_wrapping, + .filter = &un_op_filter_drop_user, + .filter_user = &data, .fn_map = &isl_map_range_factor_range, }; return un_op(umap, &control); @@ -2090,8 +2179,10 @@ __isl_give isl_union_map *isl_union_map_range_factor_range( __isl_give isl_union_map *isl_union_map_factor_domain( __isl_take isl_union_map *umap) { + struct isl_un_op_drop_user_data data = { &isl_map_is_product }; struct isl_un_op_control control = { - .filter = &isl_map_is_product, + .filter = &un_op_filter_drop_user, + .filter_user = &data, .fn_map = &isl_map_factor_domain, }; return un_op(umap, &control); @@ -2103,8 +2194,10 @@ __isl_give isl_union_map *isl_union_map_factor_domain( __isl_give isl_union_map *isl_union_map_factor_range( __isl_take isl_union_map *umap) { + struct isl_un_op_drop_user_data data = { &isl_map_is_product }; struct isl_un_op_control control = { - .filter = &isl_map_is_product, + .filter = &un_op_filter_drop_user, + .filter_user = &data, .fn_map = &isl_map_factor_range, }; return un_op(umap, &control); @@ -2112,8 +2205,10 @@ __isl_give isl_union_map *isl_union_map_factor_range( __isl_give isl_union_map *isl_union_set_unwrap(__isl_take isl_union_set *uset) { + struct isl_un_op_drop_user_data data = { &isl_set_is_wrapping }; struct isl_un_op_control control = { - .filter = &isl_set_is_wrapping, + .filter = &un_op_filter_drop_user, + .filter_user = &data, .fn_map = &isl_set_unwrap, }; return un_op(uset, &control); @@ -2432,6 +2527,15 @@ static isl_bool union_map_forall_user(__isl_keep isl_union_map *umap, return data.res; } +/* Is "umap" obviously empty? + */ +isl_bool isl_union_map_plain_is_empty(__isl_keep isl_union_map *umap) +{ + if (!umap) + return isl_bool_error; + return isl_union_map_n_map(umap) == 0; +} + isl_bool isl_union_map_is_empty(__isl_keep isl_union_map *umap) { return union_map_forall(umap, &isl_map_is_empty); @@ -2907,8 +3011,10 @@ isl_bool isl_union_map_is_bijective(__isl_keep isl_union_map *umap) __isl_give isl_union_map *isl_union_map_zip(__isl_take isl_union_map *umap) { + struct isl_un_op_drop_user_data data = { &isl_map_can_zip }; struct isl_un_op_control control = { - .filter = &isl_map_can_zip, + .filter = &un_op_filter_drop_user, + .filter_user = &data, .fn_map = &isl_map_zip, }; return un_op(umap, &control); @@ -2919,8 +3025,10 @@ __isl_give isl_union_map *isl_union_map_zip(__isl_take isl_union_map *umap) */ __isl_give isl_union_map *isl_union_map_uncurry(__isl_take isl_union_map *umap) { + struct isl_un_op_drop_user_data data = { &isl_map_can_uncurry }; struct isl_un_op_control control = { - .filter = &isl_map_can_uncurry, + .filter = &un_op_filter_drop_user, + .filter_user = &data, .fn_map = &isl_map_uncurry, }; return un_op(umap, &control); @@ -2931,8 +3039,10 @@ __isl_give isl_union_map *isl_union_map_uncurry(__isl_take isl_union_map *umap) */ __isl_give isl_union_map *isl_union_map_curry(__isl_take isl_union_map *umap) { + struct isl_un_op_drop_user_data data = { &isl_map_can_curry }; struct isl_un_op_control control = { - .filter = &isl_map_can_curry, + .filter = &un_op_filter_drop_user, + .filter_user = &data, .fn_map = &isl_map_curry, }; return un_op(umap, &control); @@ -2944,8 +3054,10 @@ __isl_give isl_union_map *isl_union_map_curry(__isl_take isl_union_map *umap) __isl_give isl_union_map *isl_union_map_range_curry( __isl_take isl_union_map *umap) { + struct isl_un_op_drop_user_data data = { &isl_map_can_range_curry }; struct isl_un_op_control control = { - .filter = &isl_map_can_range_curry, + .filter = &un_op_filter_drop_user, + .filter_user = &data, .fn_map = &isl_map_range_curry, }; return un_op(umap, &control); @@ -3406,8 +3518,8 @@ static __isl_give isl_union_map *preimage_union_pw_multi_aff( * In other words, plug in "upma" in the domain of "umap". * The result contains maps that live in the same spaces as the maps of "umap" * with domain space equal to one of the target spaces of "upma", - * except that the domain has been replaced by one of the the domain spaces that - * corresponds to that target space of "upma". + * except that the domain has been replaced by one of the domain spaces that + * correspond to that target space of "upma". */ __isl_give isl_union_map *isl_union_map_preimage_domain_union_pw_multi_aff( __isl_take isl_union_map *umap, @@ -3422,8 +3534,8 @@ __isl_give isl_union_map *isl_union_map_preimage_domain_union_pw_multi_aff( * In other words, plug in "upma" in the range of "umap". * The result contains maps that live in the same spaces as the maps of "umap" * with range space equal to one of the target spaces of "upma", - * except that the range has been replaced by one of the the domain spaces that - * corresponds to that target space of "upma". + * except that the range has been replaced by one of the domain spaces that + * correspond to that target space of "upma". */ __isl_give isl_union_map *isl_union_map_preimage_range_union_pw_multi_aff( __isl_take isl_union_map *umap, @@ -3437,8 +3549,8 @@ __isl_give isl_union_map *isl_union_map_preimage_range_union_pw_multi_aff( * In other words, plug in "upma" in the range of "uset". * The result contains sets that live in the same spaces as the sets of "uset" * with space equal to one of the target spaces of "upma", - * except that the space has been replaced by one of the the domain spaces that - * corresponds to that target space of "upma". + * except that the space has been replaced by one of the domain spaces that + * correspond to that target space of "upma". */ __isl_give isl_union_set *isl_union_set_preimage_union_pw_multi_aff( __isl_take isl_union_set *uset, @@ -3547,6 +3659,20 @@ __isl_give isl_union_map *isl_union_map_project_out( return data.res; } +/* Project out all parameters from "umap" by existentially quantifying + * over them. + */ +__isl_give isl_union_map *isl_union_map_project_out_all_params( + __isl_take isl_union_map *umap) +{ + unsigned n; + + if (!umap) + return NULL; + n = isl_union_map_dim(umap, isl_dim_param); + return isl_union_map_project_out(umap, isl_dim_param, 0, n); +} + /* Turn the "n" dimensions of type "type", starting at "first" * into existentially quantified variables. * Since the space of an isl_union_set only contains parameters, @@ -3881,3 +4007,48 @@ __isl_give isl_basic_set_list *isl_union_set_get_basic_set_list( return list; } + +/* Internal data structure for isl_union_map_remove_map_if. + * "fn" and "user" are the arguments to isl_union_map_remove_map_if. + */ +struct isl_union_map_remove_map_if_data { + isl_bool (*fn)(__isl_keep isl_map *map, void *user); + void *user; +}; + +/* isl_un_op_control filter that negates the result of data->fn + * called on "map". + */ +static isl_bool not(__isl_keep isl_map *map, void *user) +{ + struct isl_union_map_remove_map_if_data *data = user; + + return isl_bool_not(data->fn(map, data->user)); +} + +/* Dummy isl_un_op_control transformation callback that + * simply returns the input. + */ +static __isl_give isl_map *map_id(__isl_take isl_map *map) +{ + return map; +} + +/* Call "fn" on every map in "umap" and remove those maps + * for which the callback returns true. + * + * Use un_op to keep only those maps that are not filtered out, + * applying an identity transformation on them. + */ +__isl_give isl_union_map *isl_union_map_remove_map_if( + __isl_take isl_union_map *umap, + isl_bool (*fn)(__isl_keep isl_map *map, void *user), void *user) +{ + struct isl_union_map_remove_map_if_data data = { fn, user }; + struct isl_un_op_control control = { + .filter = ¬, + .filter_user = &data, + .fn_map = &map_id, + }; + return un_op(umap, &control); +} diff --git a/polly/lib/External/isl/isl_union_map_private.h b/polly/lib/External/isl/isl_union_map_private.h index 1edd7609a956..b6912d45c675 100644 --- a/polly/lib/External/isl/isl_union_map_private.h +++ b/polly/lib/External/isl/isl_union_map_private.h @@ -12,5 +12,7 @@ struct isl_union_map { isl_bool isl_union_map_space_has_equal_params(__isl_keep isl_union_map *umap, __isl_keep isl_space *space); +isl_bool isl_union_set_space_has_equal_params(__isl_keep isl_union_set *uset, + __isl_keep isl_space *space); __isl_give isl_union_map *isl_union_map_reset_range_space( __isl_take isl_union_map *umap, __isl_take isl_space *space); diff --git a/polly/lib/External/isl/isl_union_templ.c b/polly/lib/External/isl/isl_union_templ.c index 85f0570b07cc..b2ad551ed919 100644 --- a/polly/lib/External/isl/isl_union_templ.c +++ b/polly/lib/External/isl/isl_union_templ.c @@ -870,38 +870,6 @@ static __isl_give UNION *FN(UNION,negate_type)(__isl_take UNION *u) } #endif -static __isl_give PART *FN(UNION,mul_isl_int_entry)(__isl_take PART *part, - void *user) -{ - isl_int *v = user; - - return FN(PW,mul_isl_int)(part, *v); -} - -__isl_give UNION *FN(UNION,mul_isl_int)(__isl_take UNION *u, isl_int v) -{ - if (isl_int_is_one(v)) - return u; - - if (DEFAULT_IS_ZERO && u && isl_int_is_zero(v)) { - UNION *zero; - isl_space *dim = FN(UNION,get_space)(u); -#ifdef HAS_TYPE - zero = FN(UNION,ZERO)(dim, u->type); -#else - zero = FN(UNION,ZERO)(dim); -#endif - FN(UNION,free)(u); - return zero; - } - - u = FN(UNION,transform_inplace)(u, &FN(UNION,mul_isl_int_entry), &v); - if (isl_int_is_neg(v)) - u = FN(UNION,negate_type)(u); - - return u; -} - /* Multiply "part" by the isl_val "user" and return the result. */ static __isl_give PART *FN(UNION,scale_val_entry)(__isl_take PART *part, diff --git a/polly/lib/External/isl/isl_val.c b/polly/lib/External/isl/isl_val.c index b2a98faf70de..e6d4cba9b4cb 100644 --- a/polly/lib/External/isl/isl_val.c +++ b/polly/lib/External/isl/isl_val.c @@ -1490,7 +1490,7 @@ __isl_give isl_val *isl_val_insert_dims(__isl_take isl_val *v, return v; } -/* Drop the the "n" first dimensions of type "type" at position "first". +/* Drop the "n" first dimensions of type "type" at position "first". * * 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 @@ -1641,6 +1641,7 @@ isl_stat isl_val_check_match_domain_space(__isl_keep isl_val *v, #define NO_FROM_BASE #define NO_MOVE_DIMS #include +#include /* Apply "fn" to each of the elements of "mv" with as second argument "v". */ diff --git a/polly/lib/External/isl/isl_vec.c b/polly/lib/External/isl/isl_vec.c index a48abf9ed4ad..4d5bed7894ad 100644 --- a/polly/lib/External/isl/isl_vec.c +++ b/polly/lib/External/isl/isl_vec.c @@ -13,7 +13,6 @@ #include #include #include -#include isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec) { @@ -126,6 +125,19 @@ __isl_give isl_vec *isl_vec_expand(__isl_take isl_vec *vec, int pos, int n, return vec; } +/* Create a vector of size "size" with zero-valued elements. + */ +__isl_give isl_vec *isl_vec_zero(isl_ctx *ctx, unsigned size) +{ + isl_vec *vec; + + vec = isl_vec_alloc(ctx, size); + if (!vec) + return NULL; + isl_seq_clr(vec->el, size); + return vec; +} + __isl_give isl_vec *isl_vec_zero_extend(__isl_take isl_vec *vec, unsigned size) { int extra; @@ -238,18 +250,6 @@ int isl_vec_size(__isl_keep isl_vec *vec) return vec ? vec->size : -1; } -int isl_vec_get_element(__isl_keep isl_vec *vec, int pos, isl_int *v) -{ - if (!vec) - return -1; - - if (pos < 0 || pos >= vec->size) - isl_die(vec->ctx, isl_error_invalid, "position out of range", - return -1); - isl_int_set(*v, vec->el[pos]); - return 0; -} - /* Extract the element at position "pos" of "vec". */ __isl_give isl_val *isl_vec_get_element_val(__isl_keep isl_vec *vec, int pos) diff --git a/polly/lib/External/isl/isl_vertices.c b/polly/lib/External/isl/isl_vertices.c index f70e410daac0..594effcaa52f 100644 --- a/polly/lib/External/isl/isl_vertices.c +++ b/polly/lib/External/isl/isl_vertices.c @@ -229,28 +229,6 @@ error: return NULL; } -static int isl_mat_rank(__isl_keep isl_mat *mat) -{ - int row, col; - isl_mat *H; - - H = isl_mat_left_hermite(isl_mat_copy(mat), 0, NULL, NULL); - if (!H) - return -1; - - for (col = 0; col < H->n_col; ++col) { - for (row = 0; row < H->n_row; ++row) - if (!isl_int_is_zero(H->row[row][col])) - break; - if (row == H->n_row) - break; - } - - isl_mat_free(H); - - return col; -} - /* Is the row pointed to by "f" linearly independent of the "n" first * rows in "facets"? */ diff --git a/polly/lib/External/isl/libisl-gdb.py b/polly/lib/External/isl/libisl-gdb.py new file mode 100644 index 000000000000..fd15626c7739 --- /dev/null +++ b/polly/lib/External/isl/libisl-gdb.py @@ -0,0 +1,100 @@ +import gdb +import re + +# GDB Pretty Printers for most isl objects +class IslObjectPrinter: + """Print an isl object""" + def __init__ (self, val, type): + self.val = val + self.type = type + + def to_string (self): + # Cast val to a void pointer to stop gdb using this pretty + # printer for the pointer which would lead to an infinite loop. + void_ptr = gdb.lookup_type('void').pointer() + value = str(self.val.cast(void_ptr)) + printer = gdb.parse_and_eval("isl_printer_to_str(isl_" + + str(self.type) + + "_get_ctx(" + value + "))") + printer = gdb.parse_and_eval("isl_printer_print_" + + str(self.type) + "(" + + str(printer) + ", " + + value + ")") + string = gdb.parse_and_eval("(char*)isl_printer_get_str(" + + str(printer) + ")") + gdb.parse_and_eval("isl_printer_free(" + str(printer) + ")") + return string + + def display_hint (self): + return 'string' + +class IslIntPrinter: + """Print an isl_int """ + def __init__ (self, val): + self.val = val + + def to_string (self): + # Cast val to a void pointer to stop gdb using this pretty + # printer for the pointer which would lead to an infinite loop. + void_ptr = gdb.lookup_type('void').pointer() + value = str(self.val.cast(void_ptr)) + + context = gdb.parse_and_eval("isl_ctx_alloc()") + printer = gdb.parse_and_eval("isl_printer_to_str(" + + str(context) + ")") + printer = gdb.parse_and_eval("isl_printer_print_isl_int(" + + str(printer) + ", " + + value + ")") + string = gdb.parse_and_eval("(char*)isl_printer_get_str(" + + str(printer) + ")") + gdb.parse_and_eval("isl_printer_free(" + str(printer) + ")") + gdb.parse_and_eval("isl_ctx_free(" + str(context) + ")") + return string + + def display_hint (self): + return 'string' + +class IslPrintCommand (gdb.Command): + """Print an isl value.""" + def __init__ (self): + super (IslPrintCommand, self).__init__ ("islprint", + gdb.COMMAND_OBSCURE) + def invoke (self, arg, from_tty): + arg = gdb.parse_and_eval(arg); + printer = str_lookup_function(arg) + + if printer == None: + print("No isl printer for this type") + return + + print(printer.to_string()) + +IslPrintCommand() + +def str_lookup_function (val): + if val.type.code != gdb.TYPE_CODE_PTR: + if str(val.type) == "isl_int": + return IslIntPrinter(val) + else: + return None + + lookup_tag = val.type.target() + regex = re.compile ("^isl_(.*)$") + + if lookup_tag == None: + return None + + m = regex.match (str(lookup_tag)) + + if m: + # Those types of printers defined in isl. + if m.group(1) in ["basic_set", "set", "union_set", "basic_map", + "map", "union_map", "qpolynomial", + "pw_qpolynomial", "pw_qpolynomial_fold", + "union_pw_qpolynomial", + "union_pw_qpolynomial_fold"]: + return IslObjectPrinter(val, m.group(1)) + return None + +# Do not register the pretty printer. +# gdb.current_objfile().pretty_printers.append(str_lookup_function) diff --git a/polly/lib/External/isl/m4/ax_cxx_compile_stdcxx.m4 b/polly/lib/External/isl/m4/ax_cxx_compile_stdcxx.m4 deleted file mode 100644 index 5032bba8091d..000000000000 --- a/polly/lib/External/isl/m4/ax_cxx_compile_stdcxx.m4 +++ /dev/null @@ -1,982 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the specified -# version of the C++ standard. If necessary, add switches to CXX and -# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) -# or '14' (for the C++14 standard). -# -# The second argument, if specified, indicates whether you insist on an -# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -# -std=c++11). If neither is specified, you get whatever works, with -# preference for an extended mode. -# -# The third argument, if specified 'mandatory' or if left unspecified, -# indicates that baseline support for the specified C++ standard is -# required and that the macro should error out if no mode with that -# support is found. If specified 'optional', then configuration proceeds -# regardless, after defining HAVE_CXX${VERSION} if and only if a -# supporting mode is found. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik -# Copyright (c) 2012 Zack Weinberg -# Copyright (c) 2013 Roy Stogner -# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov -# Copyright (c) 2015 Paul Norman -# Copyright (c) 2015 Moritz Klammler -# Copyright (c) 2016 Krzesimir Nowak -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 7 - -dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro -dnl (serial version number 13). - -AX_REQUIRE_DEFINED([AC_MSG_WARN]) -AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl - m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], - [$1], [14], [ax_cxx_compile_alternatives="14 1y"], - [$1], [17], [ax_cxx_compile_alternatives="17 1z"], - [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$2], [], [], - [$2], [ext], [], - [$2], [noext], [], - [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], - [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], - [$3], [optional], [ax_cxx_compile_cxx$1_required=false], - [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) - AC_LANG_PUSH([C++])dnl - ac_success=no - AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, - ax_cv_cxx_compile_cxx$1, - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [ax_cv_cxx_compile_cxx$1=yes], - [ax_cv_cxx_compile_cxx$1=no])]) - if test x$ax_cv_cxx_compile_cxx$1 = xyes; then - ac_success=yes - fi - - m4_if([$2], [noext], [], [dnl - if test x$ac_success = xno; then - for alternative in ${ax_cxx_compile_alternatives}; do - switch="-std=gnu++${alternative}" - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - fi]) - - m4_if([$2], [ext], [], [dnl - if test x$ac_success = xno; then - dnl HP's aCC needs +std=c++11 according to: - dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf - dnl Cray's crayCC needs "-h std=c++11" - for alternative in ${ax_cxx_compile_alternatives}; do - for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - if test x$ac_success = xyes; then - break - fi - done - fi]) - AC_LANG_POP([C++]) - if test x$ax_cxx_compile_cxx$1_required = xtrue; then - if test x$ac_success = xno; then - AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) - fi - fi - if test x$ac_success = xno; then - HAVE_CXX$1=0 - AC_MSG_NOTICE([No compiler with C++$1 support was found]) - else - HAVE_CXX$1=1 - AC_DEFINE(HAVE_CXX$1,1, - [define if the compiler supports basic C++$1 syntax]) - fi - AC_SUBST(HAVE_CXX$1) - m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may change in incompatible ways anytime])]) -]) - - -dnl Test body for checking C++11 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 -) - - -dnl Test body for checking C++14 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 -) - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 -) - -dnl Tests for new features in C++11 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ - -// If the compiler admits that it is not ready for C++11, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201103L - -#error "This is not a C++11 compiler" - -#else - -namespace cxx11 -{ - - namespace test_static_assert - { - - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - } - - namespace test_final_override - { - - struct Base - { - virtual void f() {} - }; - - struct Derived : public Base - { - virtual void f() override {} - }; - - } - - namespace test_double_right_angle_brackets - { - - template < typename T > - struct check {}; - - typedef check single_type; - typedef check> double_type; - typedef check>> triple_type; - typedef check>>> quadruple_type; - - } - - namespace test_decltype - { - - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } - - } - - namespace test_type_deduction - { - - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - - template < typename T > - struct is_same - { - static const bool value = true; - }; - - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } - - int - test(const int c, volatile int v) - { - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } - - } - - namespace test_noexcept - { - - int f() { return 0; } - int g() noexcept { return 0; } - - static_assert(noexcept(f()) == false, ""); - static_assert(noexcept(g()) == true, ""); - - } - - namespace test_constexpr - { - - template < typename CharT > - unsigned long constexpr - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept - { - return *s ? strlen_c_r(s + 1, acc + 1) : acc; - } - - template < typename CharT > - unsigned long constexpr - strlen_c(const CharT *const s) noexcept - { - return strlen_c_r(s, 0UL); - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("1") == 1UL, ""); - static_assert(strlen_c("example") == 7UL, ""); - static_assert(strlen_c("another\0example") == 7UL, ""); - - } - - namespace test_rvalue_references - { - - template < int N > - struct answer - { - static constexpr int value = N; - }; - - answer<1> f(int&) { return answer<1>(); } - answer<2> f(const int&) { return answer<2>(); } - answer<3> f(int&&) { return answer<3>(); } - - void - test() - { - int i = 0; - const int c = 0; - static_assert(decltype(f(i))::value == 1, ""); - static_assert(decltype(f(c))::value == 2, ""); - static_assert(decltype(f(0))::value == 3, ""); - } - - } - - namespace test_uniform_initialization - { - - struct test - { - static const int zero {}; - static const int one {1}; - }; - - static_assert(test::zero == 0, ""); - static_assert(test::one == 1, ""); - - } - - namespace test_lambdas - { - - void - test1() - { - auto lambda1 = [](){}; - auto lambda2 = lambda1; - lambda1(); - lambda2(); - } - - int - test2() - { - auto a = [](int i, int j){ return i + j; }(1, 2); - auto b = []() -> int { return '0'; }(); - auto c = [=](){ return a + b; }(); - auto d = [&](){ return c; }(); - auto e = [a, &b](int x) mutable { - const auto identity = [](int y){ return y; }; - for (auto i = 0; i < a; ++i) - a += b--; - return x + identity(a + b); - }(0); - return a + b + c + d + e; - } - - int - test3() - { - const auto nullary = [](){ return 0; }; - const auto unary = [](int x){ return x; }; - using nullary_t = decltype(nullary); - using unary_t = decltype(unary); - const auto higher1st = [](nullary_t f){ return f(); }; - const auto higher2nd = [unary](nullary_t f1){ - return [unary, f1](unary_t f2){ return f2(unary(f1())); }; - }; - return higher1st(nullary) + higher2nd(nullary)(unary); - } - - } - - namespace test_variadic_templates - { - - template - struct sum; - - template - struct sum - { - static constexpr auto value = N0 + sum::value; - }; - - template <> - struct sum<> - { - static constexpr auto value = 0; - }; - - static_assert(sum<>::value == 0, ""); - static_assert(sum<1>::value == 1, ""); - static_assert(sum<23>::value == 23, ""); - static_assert(sum<1, 2>::value == 3, ""); - static_assert(sum<5, 5, 11>::value == 21, ""); - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - - } - - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function - // because of this. - namespace test_template_alias_sfinae - { - - struct foo {}; - - template - using member = typename T::member_type; - - template - void func(...) {} - - template - void func(member*) {} - - void test(); - - void test() { func(0); } - - } - -} // namespace cxx11 - -#endif // __cplusplus >= 201103L - -]]) - - -dnl Tests for new features in C++14 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ - -// If the compiler admits that it is not ready for C++14, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201402L - -#error "This is not a C++14 compiler" - -#else - -namespace cxx14 -{ - - namespace test_polymorphic_lambdas - { - - int - test() - { - const auto lambda = [](auto&&... args){ - const auto istiny = [](auto x){ - return (sizeof(x) == 1UL) ? 1 : 0; - }; - const int aretiny[] = { istiny(args)... }; - return aretiny[0]; - }; - return lambda(1, 1L, 1.0f, '1'); - } - - } - - namespace test_binary_literals - { - - constexpr auto ivii = 0b0000000000101010; - static_assert(ivii == 42, "wrong value"); - - } - - namespace test_generalized_constexpr - { - - template < typename CharT > - constexpr unsigned long - strlen_c(const CharT *const s) noexcept - { - auto length = 0UL; - for (auto p = s; *p; ++p) - ++length; - return length; - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("x") == 1UL, ""); - static_assert(strlen_c("test") == 4UL, ""); - static_assert(strlen_c("another\0test") == 7UL, ""); - - } - - namespace test_lambda_init_capture - { - - int - test() - { - auto x = 0; - const auto lambda1 = [a = x](int b){ return a + b; }; - const auto lambda2 = [a = lambda1(x)](){ return a; }; - return lambda2(); - } - - } - - namespace test_digit_separators - { - - constexpr auto ten_million = 100'000'000; - static_assert(ten_million == 100000000, ""); - - } - - namespace test_return_type_deduction - { - - auto f(int& x) { return x; } - decltype(auto) g(int& x) { return x; } - - template < typename T1, typename T2 > - struct is_same - { - static constexpr auto value = false; - }; - - template < typename T > - struct is_same - { - static constexpr auto value = true; - }; - - int - test() - { - auto x = 0; - static_assert(is_same::value, ""); - static_assert(is_same::value, ""); - return x; - } - - } - -} // namespace cxx14 - -#endif // __cplusplus >= 201402L - -]]) - - -dnl Tests for new features in C++17 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ - -// If the compiler admits that it is not ready for C++17, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus <= 201402L - -#error "This is not a C++17 compiler" - -#else - -#if defined(__clang__) - #define REALLY_CLANG -#else - #if defined(__GNUC__) - #define REALLY_GCC - #endif -#endif - -#include -#include -#include - -namespace cxx17 -{ - -#if !defined(REALLY_CLANG) - namespace test_constexpr_lambdas - { - - // TODO: test it with clang++ from git - - constexpr int foo = [](){return 42;}(); - - } -#endif // !defined(REALLY_CLANG) - - namespace test::nested_namespace::definitions - { - - } - - namespace test_fold_expression - { - - template - int multiply(Args... args) - { - return (args * ... * 1); - } - - template - bool all(Args... args) - { - return (args && ...); - } - - } - - namespace test_extended_static_assert - { - - static_assert (true); - - } - - namespace test_auto_brace_init_list - { - - auto foo = {5}; - auto bar {5}; - - static_assert(std::is_same, decltype(foo)>::value); - static_assert(std::is_same::value); - } - - namespace test_typename_in_template_template_parameter - { - - template typename X> struct D; - - } - - namespace test_fallthrough_nodiscard_maybe_unused_attributes - { - - int f1() - { - return 42; - } - - [[nodiscard]] int f2() - { - [[maybe_unused]] auto unused = f1(); - - switch (f1()) - { - case 17: - f1(); - [[fallthrough]]; - case 42: - f1(); - } - return f1(); - } - - } - - namespace test_extended_aggregate_initialization - { - - struct base1 - { - int b1, b2 = 42; - }; - - struct base2 - { - base2() { - b3 = 42; - } - int b3; - }; - - struct derived : base1, base2 - { - int d; - }; - - derived d1 {{1, 2}, {}, 4}; // full initialization - derived d2 {{}, {}, 4}; // value-initialized bases - - } - - namespace test_general_range_based_for_loop - { - - struct iter - { - int i; - - int& operator* () - { - return i; - } - - const int& operator* () const - { - return i; - } - - iter& operator++() - { - ++i; - return *this; - } - }; - - struct sentinel - { - int i; - }; - - bool operator== (const iter& i, const sentinel& s) - { - return i.i == s.i; - } - - bool operator!= (const iter& i, const sentinel& s) - { - return !(i == s); - } - - struct range - { - iter begin() const - { - return {0}; - } - - sentinel end() const - { - return {5}; - } - }; - - void f() - { - range r {}; - - for (auto i : r) - { - [[maybe_unused]] auto v = i; - } - } - - } - - namespace test_lambda_capture_asterisk_this_by_value - { - - struct t - { - int i; - int foo() - { - return [*this]() - { - return i; - }(); - } - }; - - } - - namespace test_enum_class_construction - { - - enum class byte : unsigned char - {}; - - byte foo {42}; - - } - - namespace test_constexpr_if - { - - template - int f () - { - if constexpr(cond) - { - return 13; - } - else - { - return 42; - } - } - - } - - namespace test_selection_statement_with_initializer - { - - int f() - { - return 13; - } - - int f2() - { - if (auto i = f(); i > 0) - { - return 3; - } - - switch (auto i = f(); i + 4) - { - case 17: - return 2; - - default: - return 1; - } - } - - } - -#if !defined(REALLY_CLANG) - namespace test_template_argument_deduction_for_class_templates - { - - // TODO: test it with clang++ from git - - template - struct pair - { - pair (T1 p1, T2 p2) - : m1 {p1}, - m2 {p2} - {} - - T1 m1; - T2 m2; - }; - - void f() - { - [[maybe_unused]] auto p = pair{13, 42u}; - } - - } -#endif // !defined(REALLY_CLANG) - - namespace test_non_type_auto_template_parameters - { - - template - struct B - {}; - - B<5> b1; - B<'a'> b2; - - } - -#if !defined(REALLY_CLANG) - namespace test_structured_bindings - { - - // TODO: test it with clang++ from git - - int arr[2] = { 1, 2 }; - std::pair pr = { 1, 2 }; - - auto f1() -> int(&)[2] - { - return arr; - } - - auto f2() -> std::pair& - { - return pr; - } - - struct S - { - int x1 : 2; - volatile double y1; - }; - - S f3() - { - return {}; - } - - auto [ x1, y1 ] = f1(); - auto& [ xr1, yr1 ] = f1(); - auto [ x2, y2 ] = f2(); - auto& [ xr2, yr2 ] = f2(); - const auto [ x3, y3 ] = f3(); - - } -#endif // !defined(REALLY_CLANG) - -#if !defined(REALLY_CLANG) - namespace test_exception_spec_type_system - { - - // TODO: test it with clang++ from git - - struct Good {}; - struct Bad {}; - - void g1() noexcept; - void g2(); - - template - Bad - f(T*, T*); - - template - Good - f(T1*, T2*); - - static_assert (std::is_same_v); - - } -#endif // !defined(REALLY_CLANG) - - namespace test_inline_variables - { - - template void f(T) - {} - - template inline T g(T) - { - return T{}; - } - - template<> inline void f<>(int) - {} - - template<> int g<>(int) - { - return 5; - } - - } - -} // namespace cxx17 - -#endif // __cplusplus <= 201402L - -]]) diff --git a/polly/lib/External/isl/m4/ax_cxx_compile_stdcxx_11.m4 b/polly/lib/External/isl/m4/ax_cxx_compile_stdcxx_11.m4 deleted file mode 100644 index 0aadeafe78eb..000000000000 --- a/polly/lib/External/isl/m4/ax_cxx_compile_stdcxx_11.m4 +++ /dev/null @@ -1,39 +0,0 @@ -# ============================================================================ -# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html -# ============================================================================ -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the C++11 -# standard; if necessary, add switches to CXX and CXXCPP to enable -# support. -# -# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX -# macro with the version set to C++11. The two optional arguments are -# forwarded literally as the second and third argument respectively. -# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for -# more information. If you want to use this macro, you also need to -# download the ax_cxx_compile_stdcxx.m4 file. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik -# Copyright (c) 2012 Zack Weinberg -# Copyright (c) 2013 Roy Stogner -# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov -# Copyright (c) 2015 Paul Norman -# Copyright (c) 2015 Moritz Klammler -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 17 - -AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) -AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])]) diff --git a/polly/lib/External/isl/print.c b/polly/lib/External/isl/print.c index bea1ff192848..44855a2e990a 100644 --- a/polly/lib/External/isl/print.c +++ b/polly/lib/External/isl/print.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -66,9 +65,6 @@ #define BASE union_pw_qpolynomial_fold #include #undef BASE -#define BASE band -#include -#undef BASE #define BASE constraint #include #undef BASE diff --git a/polly/lib/External/isl/schedule.c b/polly/lib/External/isl/schedule.c index 2373914c1e4e..8dd58f13e1f3 100644 --- a/polly/lib/External/isl/schedule.c +++ b/polly/lib/External/isl/schedule.c @@ -13,6 +13,7 @@ #include #include #include +#include int main(int argc, char **argv) { diff --git a/polly/lib/External/isl/test_inputs/schedule/disjunctive_domain.sc b/polly/lib/External/isl/test_inputs/schedule/disjunctive_domain.sc new file mode 100644 index 000000000000..47eedb24cbd0 --- /dev/null +++ b/polly/lib/External/isl/test_inputs/schedule/disjunctive_domain.sc @@ -0,0 +1,4 @@ +# Check that the size computation used for loop coalescing avoidance +# does not get confused by disjunctive domains. +domain: [N] -> { S_9[k, i, j = k] : 0 < k <= -3 + N and k < i < N; S_9[k, k, j] : 0 < k <= -3 + N and k <= j < N; S_9[-2 + N, i, j] : N >= 3 and -2 + N <= i < N and -2 + N <= j < N } +validity: [N] -> { S_9[k, 1 + N, j] -> S_9[1 + k, -1 + N, j'] : 0 < k <= -3 + N and j < N and j' > k and -1 + j <= j' <= j; S_9[-2 + N, i, -2 + N] -> S_9[-2 + N, i, -1 + N] : N >= 3 and -2 + N <= i < N} diff --git a/polly/lib/External/isl/test_inputs/schedule/disjunctive_domain.st b/polly/lib/External/isl/test_inputs/schedule/disjunctive_domain.st new file mode 100644 index 000000000000..05d0b89c7d0e --- /dev/null +++ b/polly/lib/External/isl/test_inputs/schedule/disjunctive_domain.st @@ -0,0 +1,5 @@ +domain: "[N] -> { S_9[k, i, j = k] : 0 < k <= -3 + N and k < i < N; S_9[k, i = k, j] : 0 < k <= -3 + N and k <= j < N; S_9[k = -2 + N, i, j] : N >= 3 and -2 + N <= i < N and -2 + N <= j < N }" +child: + schedule: "[N] -> [{ S_9[k, i, j] -> [(k)] }, { S_9[k, i, j] -> [(2k + i)] }, { S_9[k, i, j] -> [(k + j)] }]" + permutable: 1 + coincident: [ 1, 1, 1 ] diff --git a/polly/lib/External/isl/test_inputs/schedule/feautrier_compressed.st b/polly/lib/External/isl/test_inputs/schedule/feautrier_compressed.st index 8d6c654227a5..fb2a4257cd24 100644 --- a/polly/lib/External/isl/test_inputs/schedule/feautrier_compressed.st +++ b/polly/lib/External/isl/test_inputs/schedule/feautrier_compressed.st @@ -4,8 +4,4 @@ child: - filter: "{ B[i0]; A[] }" child: schedule: "[{ B[i0] -> [(1)]; A[] -> [(0)] }]" - child: - set: - - filter: "{ A[] }" - - filter: "{ B[i0] }" - filter: "{ C[] }" diff --git a/polly/lib/External/isl/uset_to_umap.c b/polly/lib/External/isl/uset_to_umap.c new file mode 100644 index 000000000000..68dcd01c9571 --- /dev/null +++ b/polly/lib/External/isl/uset_to_umap.c @@ -0,0 +1,10 @@ +#include + +/* Treat "uset" as a union map. + * Internally, isl_union_set is defined to isl_union_map, so in practice, + * this function performs a redundant cast. + */ +static __isl_give isl_union_map *uset_to_umap(__isl_take isl_union_set *uset) +{ + return (isl_union_map *) uset; +} diff --git a/polly/test/DeLICM/map_memset_zero.ll b/polly/test/DeLICM/map_memset_zero.ll index c2ee0d4f46b6..e0da6892b567 100644 --- a/polly/test/DeLICM/map_memset_zero.ll +++ b/polly/test/DeLICM/map_memset_zero.ll @@ -53,7 +53,7 @@ return: ; CHECK-NEXT: Stmt_bodyA ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] ; CHECK-NEXT: { Stmt_bodyA[i0] -> MemRef_phi__phi[] }; -; CHECK-NEXT: new: { Stmt_bodyA[i0] -> MemRef_A[o0] : 1 = 0 }; +; CHECK-NEXT: new: { Stmt_bodyA[i0] -> MemRef_A[o0] : false }; ; CHECK-NEXT: Stmt_bodyB ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] ; CHECK-NEXT: { Stmt_bodyB[i0] -> MemRef_A[i0] }; diff --git a/polly/test/ScheduleOptimizer/mat_mul_pattern_data_layout.ll b/polly/test/ScheduleOptimizer/mat_mul_pattern_data_layout.ll index 699361a00a59..8df4b858dc2b 100644 --- a/polly/test/ScheduleOptimizer/mat_mul_pattern_data_layout.ll +++ b/polly/test/ScheduleOptimizer/mat_mul_pattern_data_layout.ll @@ -22,10 +22,10 @@ ; CHECK-NEXT: double Packed_A[ { [] -> [(24)] } ][ { [] -> [(256)] } ][ { [] -> [(4)] } ]; // Element size 8 ; ; CHECK: { Stmt_Copy_0[i0, i1, i2] -> MemRef_arg6[i0, i2] }; -; CHECK-NEXT: new: { Stmt_Copy_0[i0, i1, i2] -> Packed_A[o0, o1, o2] : 256*floor((-i2 + o1)/256) = -i2 + o1 and 96*floor((-i0 + 4o0 + o2)/96) = -i0 + 4o0 + o2 and 0 <= o1 <= 255 and o2 >= 0 and -4o0 <= o2 <= 95 - 4o0 and o2 <= 3 }; +; CHECK-NEXT: new: { Stmt_Copy_0[i0, i1, i2] -> Packed_A[o0, o1, o2] : (-i2 + o1) mod 256 = 0 and (-i0 + 4o0 + o2) mod 96 = 0 and 0 <= o1 <= 255 and o2 >= 0 and -4o0 <= o2 <= 95 - 4o0 and o2 <= 3 } ; ; CHECK: { Stmt_Copy_0[i0, i1, i2] -> MemRef_arg7[i2, i1] }; -; CHECK-NEXT: new: { Stmt_Copy_0[i0, i1, i2] -> Packed_B[o0, o1, i1 - 8o0] : 256*floor((-i2 + o1)/256) = -i2 + o1 and -7 + i1 <= 8o0 <= i1 and 0 <= o1 <= 255 }; +; CHECK-NEXT: new: { Stmt_Copy_0[i0, i1, i2] -> Packed_B[o0, o1, i1 - 8o0] : (-i2 + o1) mod 256 = 0 and -7 + i1 <= 8o0 <= i1 and 0 <= o1 <= 255 } ; ; CHECK: CopyStmt_0 ; CHECK-NEXT: Domain := @@ -34,7 +34,7 @@ ; CHECK-NEXT: ; ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] ; CHECK-NEXT: ; -; CHECK-NEXT: new: { CopyStmt_0[i0, i1, i2] -> Packed_B[o0, o1, i1 - 8o0] : 256*floor((-i2 + o1)/256) = -i2 + o1 and -7 + i1 <= 8o0 <= i1 and 0 <= o1 <= 255 }; +; CHECK-NEXT: new: { CopyStmt_0[i0, i1, i2] -> Packed_B[o0, o1, i1 - 8o0] : (-i2 + o1) mod 256 = 0 and -7 + i1 <= 8o0 <= i1 and 0 <= o1 <= 255 } ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0] ; CHECK-NEXT: ; ; CHECK-NEXT: new: { CopyStmt_0[i0, i1, i2] -> MemRef_arg7[i2, i1] }; @@ -45,7 +45,7 @@ ; CHECK-NEXT: ; ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] ; CHECK-NEXT: ; -; CHECK-NEXT: new: { CopyStmt_1[i0, i1, i2] -> Packed_A[o0, o1, o2] : 256*floor((-i2 + o1)/256) = -i2 + o1 and 96*floor((-i0 + 4o0 + o2)/96) = -i0 + 4o0 + o2 and 0 <= o1 <= 255 and o2 >= 0 and -4o0 <= o2 <= 95 - 4o0 and o2 <= 3 }; +; CHECK-NEXT: new: { CopyStmt_1[i0, i1, i2] -> Packed_A[o0, o1, o2] : (-i2 + o1) mod 256 = 0 and (-i0 + 4o0 + o2) mod 96 = 0 and 0 <= o1 <= 255 and o2 >= 0 and -4o0 <= o2 <= 95 - 4o0 and o2 <= 3 }; ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0] ; CHECK-NEXT: ; ; CHECK-NEXT: new: { CopyStmt_1[i0, i1, i2] -> MemRef_arg6[i0, i2] }; diff --git a/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_1.ll b/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_1.ll index 185cca39b24a..59012efea4d1 100644 --- a/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_1.ll +++ b/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_1.ll @@ -17,7 +17,7 @@ ; SCALAR-NEXT: Assumed Context: ; SCALAR-NEXT: { : } ; SCALAR-NEXT: Invalid Context: -; SCALAR-NEXT: { : 1 = 0 } +; SCALAR-NEXT: { : false } ; SCALAR-NEXT: Arrays { ; SCALAR-NEXT: i32 MemRef_C[*]; // Element size 4 ; SCALAR-NEXT: i32 MemRef_A[*]; // Element size 4 diff --git a/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_2.ll b/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_2.ll index 70b7084d6fc0..1a6bab8618b9 100644 --- a/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_2.ll +++ b/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_2.ll @@ -25,7 +25,7 @@ ; INNERMOST-NEXT: Assumed Context: ; INNERMOST-NEXT: [p_0, p_1, p_2] -> { : } ; INNERMOST-NEXT: Invalid Context: -; INNERMOST-NEXT: [p_0, p_1, p_2] -> { : 1 = 0 } +; INNERMOST-NEXT: [p_0, p_1, p_2] -> { : false } ; INNERMOST-NEXT: p0: {0,+,{0,+,1}<%bb11>}<%bb13> ; INNERMOST-NEXT: p1: {0,+,1}<%bb11> ; INNERMOST-NEXT: p2: {0,+,1}<%bb13> @@ -76,7 +76,7 @@ ; ALL-NEXT: Assumed Context: ; ALL-NEXT: { : } ; ALL-NEXT: Invalid Context: -; ALL-NEXT: { : 1 = 0 } +; ALL-NEXT: { : false } ; ALL-NEXT: Arrays { ; ALL-NEXT: i32 MemRef_A[*]; // Element size 4 ; ALL-NEXT: } diff --git a/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_3.ll b/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_3.ll index b30539801030..26551d8d6608 100644 --- a/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_3.ll +++ b/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_3.ll @@ -24,7 +24,7 @@ ; INNERMOST-NEXT: Assumed Context: ; INNERMOST-NEXT: [p_0, p_1, p_2] -> { : } ; INNERMOST-NEXT: Invalid Context: -; INNERMOST-NEXT: [p_0, p_1, p_2] -> { : 1 = 0 } +; INNERMOST-NEXT: [p_0, p_1, p_2] -> { : false } ; INNERMOST-NEXT: p0: {0,+,{0,+,1}<%bb11>}<%bb13> ; INNERMOST-NEXT: p1: {0,+,1}<%bb11> ; INNERMOST-NEXT: p2: {0,+,1}<%bb13> @@ -75,7 +75,7 @@ ; ALL-NEXT: Assumed Context: ; ALL-NEXT: { : } ; ALL-NEXT: Invalid Context: -; ALL-NEXT: { : 1 = 0 } +; ALL-NEXT: { : false } ; ALL-NEXT: Arrays { ; ALL-NEXT: i32 MemRef_A[*]; // Element size 4 ; ALL-NEXT: } diff --git a/polly/test/ScopInfo/NonAffine/non_affine_but_srem.ll b/polly/test/ScopInfo/NonAffine/non_affine_but_srem.ll index 24f7953e225e..0c77832cfb49 100644 --- a/polly/test/ScopInfo/NonAffine/non_affine_but_srem.ll +++ b/polly/test/ScopInfo/NonAffine/non_affine_but_srem.ll @@ -19,9 +19,9 @@ ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [n] -> { Stmt_bb2[i0] -> [i0] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0] -; CHECK-NEXT: [n] -> { Stmt_bb2[i0] -> MemRef_A[o0] : 42*floor((-n + o0)/42) = -n + o0 and -41 <= o0 <= 41 and ((n < 0 and o0 <= 0) or (n >= 0 and o0 >= 0)) } +; CHECK-NEXT: [n] -> { Stmt_bb2[i0] -> MemRef_A[o0] : (-n + o0) mod 42 = 0 and -41 <= o0 <= 41 and ((n < 0 and o0 <= 0) or (n >= 0 and o0 >= 0)) } ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] -; CHECK-NEXT: [n] -> { Stmt_bb2[i0] -> MemRef_A[o0] : 42*floor((-n + o0)/42) = -n + o0 and -41 <= o0 <= 41 and ((n < 0 and o0 <= 0) or (n >= 0 and o0 >= 0)) } +; CHECK-NEXT: [n] -> { Stmt_bb2[i0] -> MemRef_A[o0] : (-n + o0) mod 42 = 0 and -41 <= o0 <= 41 and ((n < 0 and o0 <= 0) or (n >= 0 and o0 >= 0)) } ; CHECK-NEXT: } ; ; CHECK: Statements { @@ -31,9 +31,9 @@ ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [n] -> { Stmt_bb2[i0] -> [i0] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0] -; CHECK-NEXT: [n] -> { Stmt_bb2[i0] -> MemRef_A[o0] : 42*floor((-n + o0)/42) = -n + o0 and -41 <= o0 <= 41 and ((n > 0 and o0 >= 0) or (n <= 0 and o0 <= 0)) } +; CHECK-NEXT: [n] -> { Stmt_bb2[i0] -> MemRef_A[o0] : (-n + o0) mod 42 = 0 and -41 <= o0 <= 41 and ((n > 0 and o0 >= 0) or (n <= 0 and o0 <= 0)) }; ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] -; CHECK-NEXT: [n] -> { Stmt_bb2[i0] -> MemRef_A[o0] : 42*floor((-n + o0)/42) = -n + o0 and -41 <= o0 <= 41 and ((n > 0 and o0 >= 0) or (n <= 0 and o0 <= 0)) } +; CHECK-NEXT: [n] -> { Stmt_bb2[i0] -> MemRef_A[o0] : (-n + o0) mod 42 = 0 and -41 <= o0 <= 41 and ((n > 0 and o0 >= 0) or (n <= 0 and o0 <= 0)) }; ; CHECK-NEXT: } target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/polly/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_affine_loop.ll b/polly/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_affine_loop.ll index 0b5bfffbe588..2e73dff24b9b 100644 --- a/polly/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_affine_loop.ll +++ b/polly/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_affine_loop.ll @@ -75,7 +75,7 @@ ; ALL-NEXT: Assumed Context: ; ALL-NEXT: { : } ; ALL-NEXT: Invalid Context: -; ALL-NEXT: { : 1 = 0 } +; ALL-NEXT: { : false } ; ALL-NEXT: Arrays { ; ALL-NEXT: i32 MemRef_A[*]; // Element size 4 ; ALL-NEXT: } diff --git a/polly/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_non_affine_loop.ll b/polly/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_non_affine_loop.ll index b6f5c98d95d3..a593b04b4cd4 100644 --- a/polly/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_non_affine_loop.ll +++ b/polly/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_non_affine_loop.ll @@ -79,7 +79,7 @@ ; ALL-NEXT: Assumed Context: ; ALL-NEXT: { : } ; ALL-NEXT: Invalid Context: -; ALL-NEXT: { : 1 = 0 } +; ALL-NEXT: { : false } ; ALL-NEXT: Arrays { ; ALL-NEXT: i32 MemRef_A[*]; // Element size 4 ; ALL-NEXT: } diff --git a/polly/test/ScopInfo/NonAffine/non_affine_float_compare.ll b/polly/test/ScopInfo/NonAffine/non_affine_float_compare.ll index 84573f61f5a8..3302c9b9e234 100644 --- a/polly/test/ScopInfo/NonAffine/non_affine_float_compare.ll +++ b/polly/test/ScopInfo/NonAffine/non_affine_float_compare.ll @@ -17,7 +17,7 @@ ; CHECK-NEXT: Assumed Context: ; CHECK-NEXT: { : } ; CHECK-NEXT: Invalid Context: -; CHECK-NEXT: { : 1 = 0 } +; CHECK-NEXT: { : false } ; CHECK-NEXT: Arrays { ; CHECK-NEXT: float MemRef_A[*]; // Element size 4 ; CHECK-NEXT: } diff --git a/polly/test/ScopInfo/NonAffine/non_affine_loop_condition.ll b/polly/test/ScopInfo/NonAffine/non_affine_loop_condition.ll index 7222858e691b..a5cbc6d5552a 100644 --- a/polly/test/ScopInfo/NonAffine/non_affine_loop_condition.ll +++ b/polly/test/ScopInfo/NonAffine/non_affine_loop_condition.ll @@ -31,7 +31,7 @@ ; CHECK-NEXT: Assumed Context: ; CHECK-NEXT: { : } ; CHECK-NEXT: Invalid Context: -; CHECK-NEXT: { : 1 = 0 } +; CHECK-NEXT: { : false } ; CHECK-NEXT: Arrays { ; CHECK-NEXT: i32 MemRef_C[*]; // Element size 4 ; CHECK-NEXT: i32 MemRef_A[*]; // Element size 4 diff --git a/polly/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll b/polly/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll index 61d7134a5bd6..92607ef557a2 100644 --- a/polly/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll +++ b/polly/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll @@ -20,7 +20,7 @@ ; CHECK-NEXT: Assumed Context: ; CHECK-NEXT: [N] -> { : } ; CHECK-NEXT: Invalid Context: -; CHECK-NEXT: [N] -> { : 1 = 0 } +; CHECK-NEXT: [N] -> { : false } ; CHECK-NEXT: p0: %N ; CHECK-NEXT: Arrays { ; CHECK-NEXT: i32 MemRef_j_0__phi; // Element size 4 diff --git a/polly/test/ScopInfo/assume_gep_bounds_many.ll b/polly/test/ScopInfo/assume_gep_bounds_many.ll index 39e63b77c332..eb449e989e8d 100644 --- a/polly/test/ScopInfo/assume_gep_bounds_many.ll +++ b/polly/test/ScopInfo/assume_gep_bounds_many.ll @@ -4,7 +4,7 @@ ; CHECK: Assumed Context: ; CHECK-NEXT: [n1_a, n1_b, n1_c, n1_d, n2_a, n2_b, n2_c, n2_d, n3_a, n3_b, n3_c, n3_d, n4_a, n4_b, n4_c, n4_d, n5_a, n5_b, n5_c, n5_d, n6_a, n6_b, n6_c, n6_d, n7_a, n7_b, n7_c, n7_d, n8_a, n8_b, n8_c, n8_d, n9_a, n9_b, n9_c, n9_d, p1_b, p1_c, p1_d, p2_b, p2_c, p2_d, p3_b, p3_c, p3_d, p4_b, p4_c, p4_d, p5_b, p5_c, p5_d, p6_b, p6_c, p6_d, p7_b, p7_c, p7_d, p8_b, p8_c, p8_d, p9_b, p9_c, p9_d] -> { : p1_b >= n1_b and p1_c >= n1_c and p1_d >= n1_d and p2_b >= n2_b and p2_c >= n2_c and p2_d >= n2_d and p3_b >= n3_b and p3_c >= n3_c and p3_d >= n3_d and p4_b >= n4_b and p4_c >= n4_c and p4_d >= n4_d and p5_b >= n5_b and p5_c >= n5_c and p5_d >= n5_d and p6_b >= n6_b and p6_c >= n6_c and p6_d >= n6_d and p7_b >= n7_b and p7_c >= n7_c and p7_d >= n7_d and p8_b >= n8_b and p8_c >= n8_c and p8_d >= n8_d and p9_b >= n9_b and p9_c >= n9_c and p9_d >= n9_d } ; CHECK-NEXT: Invalid Context: -; CHECK-NEXT: [n1_a, n1_b, n1_c, n1_d, n2_a, n2_b, n2_c, n2_d, n3_a, n3_b, n3_c, n3_d, n4_a, n4_b, n4_c, n4_d, n5_a, n5_b, n5_c, n5_d, n6_a, n6_b, n6_c, n6_d, n7_a, n7_b, n7_c, n7_d, n8_a, n8_b, n8_c, n8_d, n9_a, n9_b, n9_c, n9_d, p1_b, p1_c, p1_d, p2_b, p2_c, p2_d, p3_b, p3_c, p3_d, p4_b, p4_c, p4_d, p5_b, p5_c, p5_d, p6_b, p6_c, p6_d, p7_b, p7_c, p7_d, p8_b, p8_c, p8_d, p9_b, p9_c, p9_d] -> { : 1 = 0 } +; CHECK-NEXT: [n1_a, n1_b, n1_c, n1_d, n2_a, n2_b, n2_c, n2_d, n3_a, n3_b, n3_c, n3_d, n4_a, n4_b, n4_c, n4_d, n5_a, n5_b, n5_c, n5_d, n6_a, n6_b, n6_c, n6_d, n7_a, n7_b, n7_c, n7_d, n8_a, n8_b, n8_c, n8_d, n9_a, n9_b, n9_c, n9_d, p1_b, p1_c, p1_d, p2_b, p2_c, p2_d, p3_b, p3_c, p3_d, p4_b, p4_c, p4_d, p5_b, p5_c, p5_d, p6_b, p6_c, p6_d, p7_b, p7_c, p7_d, p8_b, p8_c, p8_d, p9_b, p9_c, p9_d] -> { : false } ; diff --git a/polly/test/ScopInfo/avoid_new_parameters_from_geps.ll b/polly/test/ScopInfo/avoid_new_parameters_from_geps.ll index 8b00f2aa8f22..ec49b4420b40 100644 --- a/polly/test/ScopInfo/avoid_new_parameters_from_geps.ll +++ b/polly/test/ScopInfo/avoid_new_parameters_from_geps.ll @@ -11,7 +11,7 @@ ; CHECK-NEXT: Assumed Context: ; CHECK-NEXT: { : } ; CHECK-NEXT: Invalid Context: -; CHECK-NEXT: { : 1 = 0 } +; CHECK-NEXT: { : false } ; CHECK-NEXT: Arrays { ; CHECK-NEXT: i32* MemRef_team2_0_in; // Element size 8 ; CHECK-NEXT: } diff --git a/polly/test/ScopInfo/complex-branch-structure.ll b/polly/test/ScopInfo/complex-branch-structure.ll index 1e08789b2838..f57bc8aae863 100644 --- a/polly/test/ScopInfo/complex-branch-structure.ll +++ b/polly/test/ScopInfo/complex-branch-structure.ll @@ -20,7 +20,7 @@ ; \ / / ; loop backedge -; CHECK: Low complexity assumption: { : 1 = 0 } +; CHECK: Low complexity assumption: { : false } define void @foo(float* %A, float* %B, float* %C, float* %D, float* %E, i64 %A1.p, i64 %A2.p, i64 %A3.p, diff --git a/polly/test/ScopInfo/complex-condition.ll b/polly/test/ScopInfo/complex-condition.ll index 45166c4f6ca7..0faf08aaa06a 100644 --- a/polly/test/ScopInfo/complex-condition.ll +++ b/polly/test/ScopInfo/complex-condition.ll @@ -2,7 +2,7 @@ ; RUN: -polly-invariant-load-hoisting=true \ ; RUN: < %s 2>&1 | FileCheck %s ; -; CHECK: Low complexity assumption: { : 1 = 0 } +; CHECK: Low complexity assumption: { : false } ; ; The IR is a modified version of the following C: ; diff --git a/polly/test/ScopInfo/complex-expression.ll b/polly/test/ScopInfo/complex-expression.ll index 11e251649172..8ea2d3565ece 100644 --- a/polly/test/ScopInfo/complex-expression.ll +++ b/polly/test/ScopInfo/complex-expression.ll @@ -8,7 +8,7 @@ ; ; This ensures we bail out for really complex expressions: ; -; CHECK: Low complexity assumption: { : 1 = 0 } +; CHECK: Low complexity assumption: { : false } ; target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" diff --git a/polly/test/ScopInfo/complex-successor-structure-3.ll b/polly/test/ScopInfo/complex-successor-structure-3.ll index 1e3f7f70fb74..463c685453f0 100644 --- a/polly/test/ScopInfo/complex-successor-structure-3.ll +++ b/polly/test/ScopInfo/complex-successor-structure-3.ll @@ -7,7 +7,7 @@ ; CHECK: Assumed Context: ; CHECK-NEXT: [tmp5, tmp, tmp8, tmp11, tmp14, tmp17, tmp20, tmp23, tmp26] -> { : } ; CHECK-NEXT: Invalid Context: -; CHECK-NEXT: [tmp5, tmp, tmp8, tmp11, tmp14, tmp17, tmp20, tmp23, tmp26] -> { : 1 = 0 } +; CHECK-NEXT: [tmp5, tmp, tmp8, tmp11, tmp14, tmp17, tmp20, tmp23, tmp26] -> { : false } ; ; CHECK: Stmt_FINAL ; CHECK-NEXT: Domain := diff --git a/polly/test/ScopInfo/complex-successor-structure.ll b/polly/test/ScopInfo/complex-successor-structure.ll index 229f88a22e69..8f7574c1c5e7 100644 --- a/polly/test/ScopInfo/complex-successor-structure.ll +++ b/polly/test/ScopInfo/complex-successor-structure.ll @@ -9,7 +9,7 @@ ; of needed constraints (it is basically the condition of B(X) + one smax), ; thus we should bail out at some point. ; -; CHECK: Low complexity assumption: { : 1 = 0 } +; CHECK: Low complexity assumption: { : false } ; | ; for.body <--+ diff --git a/polly/test/ScopInfo/complex_domain_binary_condition.ll b/polly/test/ScopInfo/complex_domain_binary_condition.ll index 231986388eea..975cb6754e00 100644 --- a/polly/test/ScopInfo/complex_domain_binary_condition.ll +++ b/polly/test/ScopInfo/complex_domain_binary_condition.ll @@ -1,7 +1,7 @@ ; RUN: opt %loadPolly -pass-remarks-analysis="polly-scops" -polly-scops \ ; RUN: < %s 2>&1 | FileCheck %s ; -; CHECK: Low complexity assumption: { : 1 = 0 } +; CHECK: Low complexity assumption: { : false } ; target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/polly/test/ScopInfo/constant_functions_as_unknowns.ll b/polly/test/ScopInfo/constant_functions_as_unknowns.ll index 367be740f7e9..b3bbc8c2ee05 100644 --- a/polly/test/ScopInfo/constant_functions_as_unknowns.ll +++ b/polly/test/ScopInfo/constant_functions_as_unknowns.ll @@ -8,7 +8,7 @@ target triple = "x86_64-unknown-linux-gnu" ; CHECK-NEXT: Assumed Context: ; CHECK-NEXT: [__global_id_0] -> { : } ; CHECK-NEXT: Invalid Context: -; CHECK-NEXT: [__global_id_0] -> { : 1 = 0 } +; CHECK-NEXT: [__global_id_0] -> { : false } ; CHECK-NEXT: p0: %__global_id_0 ; CHECK-NEXT: Arrays { ; CHECK-NEXT: i64 MemRef_A[*]; // Element size 8 diff --git a/polly/test/ScopInfo/integers.ll b/polly/test/ScopInfo/integers.ll index 25ef908b36a6..909224e5815e 100644 --- a/polly/test/ScopInfo/integers.ll +++ b/polly/test/ScopInfo/integers.ll @@ -123,7 +123,7 @@ bb: ; CHECK-NEXT: Assumed Context: ; CHECK-NEXT: [n] -> { : } ; CHECK-NEXT: Invalid Context: -; CHECK-NEXT: [n] -> { : 1 = 0 } +; CHECK-NEXT: [n] -> { : false } ; CHECK: Statements { ; CHECK-NEXT: Stmt_bb diff --git a/polly/test/ScopInfo/inter-error-bb-dependence.ll b/polly/test/ScopInfo/inter-error-bb-dependence.ll index 0e0fcf82c5af..988445a4936e 100644 --- a/polly/test/ScopInfo/inter-error-bb-dependence.ll +++ b/polly/test/ScopInfo/inter-error-bb-dependence.ll @@ -47,5 +47,5 @@ bb36: ; preds = %bb33, %bb5 ; CHECK: SCoP begins here. -; CHECK-NEXT: Low complexity assumption: { : 1 = 0 } +; CHECK-NEXT: Low complexity assumption: { : false } ; CHECK-NEXT: SCoP ends here but was dismissed. diff --git a/polly/test/ScopInfo/invariant_load_stmt_domain.ll b/polly/test/ScopInfo/invariant_load_stmt_domain.ll index e6722f1b9748..34923177521e 100644 --- a/polly/test/ScopInfo/invariant_load_stmt_domain.ll +++ b/polly/test/ScopInfo/invariant_load_stmt_domain.ll @@ -15,7 +15,7 @@ ; CHECK-NEXT: Assumed Context: ; CHECK-NEXT: { : } ; CHECK-NEXT: Invalid Context: -; CHECK-NEXT: { : 1 = 0 } +; CHECK-NEXT: { : false } ; CHECK: Statements { ; CHECK-NEXT: Stmt_loop diff --git a/polly/test/ScopInfo/modulo_zext_1.ll b/polly/test/ScopInfo/modulo_zext_1.ll index da0e77315a85..a4e920dfe56d 100644 --- a/polly/test/ScopInfo/modulo_zext_1.ll +++ b/polly/test/ScopInfo/modulo_zext_1.ll @@ -3,7 +3,7 @@ ; CHECK: Assumed Context: ; CHECK-NEXT: [N] -> { : } ; CHECK-NEXT: Invalid Context: -; CHECK-NEXT: [N] -> { : 1 = 0 } +; CHECK-NEXT: [N] -> { : false } ; CHECK-NEXT: p0: %N ; CHECK: Statements { ; CHECK-NEXT: Stmt_for_body @@ -12,9 +12,9 @@ ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_for_body[i0] -> [i0] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] -; CHECK-NEXT: [N] -> { Stmt_for_body[i0] -> MemRef_A[1] : 2*floor((1 + i0)/2) = 1 + i0; Stmt_for_body[i0] -> MemRef_A[0] : 2*floor((i0)/2) = i0 }; +; CHECK-NEXT: [N] -> { Stmt_for_body[i0] -> MemRef_A[1] : (1 + i0) mod 2 = 0; Stmt_for_body[i0] -> MemRef_A[0] : (i0) mod 2 = 0 } ; CHECK-NEXT: MustWriteAccess := [Reduction Type: +] [Scalar: 0] -; CHECK-NEXT: [N] -> { Stmt_for_body[i0] -> MemRef_A[1] : 2*floor((1 + i0)/2) = 1 + i0; Stmt_for_body[i0] -> MemRef_A[0] : 2*floor((i0)/2) = i0 }; +; CHECK-NEXT: [N] -> { Stmt_for_body[i0] -> MemRef_A[1] : (1 + i0) mod 2 = 0; Stmt_for_body[i0] -> MemRef_A[0] : (i0) mod 2 = 0 }; ; CHECK-NEXT: } ; ; void f(int *A, int N) { diff --git a/polly/test/ScopInfo/modulo_zext_2.ll b/polly/test/ScopInfo/modulo_zext_2.ll index 70eadf2f9f42..8bf0d6ccbef3 100644 --- a/polly/test/ScopInfo/modulo_zext_2.ll +++ b/polly/test/ScopInfo/modulo_zext_2.ll @@ -3,12 +3,12 @@ ; CHECK: Assumed Context: ; CHECK-NEXT: [N] -> { : } ; CHECK-NEXT: Invalid Context: -; CHECK-NEXT: [N] -> { : 1 = 0 } +; CHECK-NEXT: [N] -> { : false } ; CHECK-NEXT: p0: %N ; CHECK: Statements { ; CHECK-NEXT: Stmt_if_then ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_if_then[i0] : 2*floor((1 + i0)/2) = 1 + i0 and 0 < i0 < N } +; CHECK-NEXT: [N] -> { Stmt_if_then[i0] : (1 + i0) mod 2 = 0 and 0 < i0 < N } ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_if_then[i0] -> [i0] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] diff --git a/polly/test/ScopInfo/multidim_2d_with_modref_call.ll b/polly/test/ScopInfo/multidim_2d_with_modref_call.ll index 6db6e9e96c9a..7523d2f6c4fa 100644 --- a/polly/test/ScopInfo/multidim_2d_with_modref_call.ll +++ b/polly/test/ScopInfo/multidim_2d_with_modref_call.ll @@ -74,7 +74,7 @@ ; NONAFFINE-NEXT: Assumed Context: ; NONAFFINE-NEXT: [tmp9, tmp14] -> { : } ; NONAFFINE-NEXT: Invalid Context: -; NONAFFINE-NEXT: [tmp9, tmp14] -> { : 1 = 0 } +; NONAFFINE-NEXT: [tmp9, tmp14] -> { : false } ; NONAFFINE-NEXT: p0: %tmp9 ; NONAFFINE-NEXT: p1: %tmp14 ; NONAFFINE-NEXT: Arrays { diff --git a/polly/test/ScopInfo/multidim_2d_with_modref_call_2.ll b/polly/test/ScopInfo/multidim_2d_with_modref_call_2.ll index f9f64a59e1ab..e02508350f1d 100644 --- a/polly/test/ScopInfo/multidim_2d_with_modref_call_2.ll +++ b/polly/test/ScopInfo/multidim_2d_with_modref_call_2.ll @@ -72,7 +72,7 @@ ; NONAFFINE-NEXT: Assumed Context: ; NONAFFINE-NEXT: [tmp9, tmp14] -> { : } ; NONAFFINE-NEXT: Invalid Context: -; NONAFFINE-NEXT: [tmp9, tmp14] -> { : 1 = 0 } +; NONAFFINE-NEXT: [tmp9, tmp14] -> { : false } ; NONAFFINE-NEXT: p0: %tmp9 ; NONAFFINE-NEXT: p1: %tmp14 ; NONAFFINE-NEXT: Arrays { diff --git a/polly/test/ScopInfo/multidim_3d_parametric_array_static_loop_bounds.ll b/polly/test/ScopInfo/multidim_3d_parametric_array_static_loop_bounds.ll index 1064b9eb4379..1963c652c2a6 100644 --- a/polly/test/ScopInfo/multidim_3d_parametric_array_static_loop_bounds.ll +++ b/polly/test/ScopInfo/multidim_3d_parametric_array_static_loop_bounds.ll @@ -12,7 +12,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 ; CHECK: Assumed Context: ; CHECK-NEXT: [m, o] -> { : m >= 150 and o >= 200 } ; CHECK: Invalid Context: -; CHECK-NEXT: [m, o] -> { : 1 = 0 } +; CHECK-NEXT: [m, o] -> { : false } ; ; CHECK: p0: %m ; CHECK-NEXT: p1: %o diff --git a/polly/test/ScopInfo/multidim_fixedsize_multi_offset.ll b/polly/test/ScopInfo/multidim_fixedsize_multi_offset.ll index e2d982cc083d..fa32b691cb57 100644 --- a/polly/test/ScopInfo/multidim_fixedsize_multi_offset.ll +++ b/polly/test/ScopInfo/multidim_fixedsize_multi_offset.ll @@ -5,7 +5,7 @@ ; CHECK: Assumed Context: ; CHECK-NEXT: { : } ; CHECK: Invalid Context: -; CHECK-NEXT: { : 1 = 0 } +; CHECK-NEXT: { : false } ; CHECK: Statements { ; CHECK-NEXT: Stmt_for_body ; CHECK-NEXT: Domain := diff --git a/polly/test/ScopInfo/multidim_fold_constant_dim_zero.ll b/polly/test/ScopInfo/multidim_fold_constant_dim_zero.ll index 771dd2cbaf92..872284811444 100644 --- a/polly/test/ScopInfo/multidim_fold_constant_dim_zero.ll +++ b/polly/test/ScopInfo/multidim_fold_constant_dim_zero.ll @@ -9,9 +9,9 @@ ; invalidated due to the zero size dimension. ; CHECK: Assumed Context: -; CHECK-NEXT: { : 1 = 0 } +; CHECK-NEXT: { : false } ; CHECK-NEXT: Invalid Context: -; CHECK-NEXT: { : 1 = 0 } +; CHECK-NEXT: { : false } ; CHECK-NEXT: Arrays { ; CHECK-NEXT: i8 MemRef_arg[*][0]; // Element size 1 ; CHECK-NEXT: } @@ -29,7 +29,7 @@ ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] ; CHECK-NEXT: { Stmt_bb2[] -> MemRef_arg[0, 0] }; ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] -; CHECK-NEXT: { Stmt_bb2[] -> MemRef_arg[o0, o1] : 1 = 0 }; +; CHECK-NEXT: { Stmt_bb2[] -> MemRef_arg[o0, o1] : false }; ; CHECK-NEXT: } target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" diff --git a/polly/test/ScopInfo/multidim_fortran_2d_with_modref_call.ll b/polly/test/ScopInfo/multidim_fortran_2d_with_modref_call.ll index e17ca9c909bc..bacd4552dea5 100644 --- a/polly/test/ScopInfo/multidim_fortran_2d_with_modref_call.ll +++ b/polly/test/ScopInfo/multidim_fortran_2d_with_modref_call.ll @@ -73,7 +73,7 @@ ; NONAFFINE-NEXT: Assumed Context: ; NONAFFINE-NEXT: [tmp9, tmp14] -> { : } ; NONAFFINE-NEXT: Invalid Context: -; NONAFFINE-NEXT: [tmp9, tmp14] -> { : 1 = 0 } +; NONAFFINE-NEXT: [tmp9, tmp14] -> { : false } ; NONAFFINE-NEXT: p0: %tmp9 ; NONAFFINE-NEXT: p1: %tmp14 ; NONAFFINE-NEXT: Arrays { diff --git a/polly/test/ScopInfo/multidim_fortran_srem.ll b/polly/test/ScopInfo/multidim_fortran_srem.ll index bc926e4393b0..c74e67e0ae00 100644 --- a/polly/test/ScopInfo/multidim_fortran_srem.ll +++ b/polly/test/ScopInfo/multidim_fortran_srem.ll @@ -19,11 +19,11 @@ target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64: ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1] ; CHECK-NEXT: [tmp180, tmp177, tmp183, tmp162, tmp157, tmp150, tmp146, tmp140, tmp] -> { Stmt_bb203[i0, i1, i2] -> MemRef_tmp192[] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0] -; CHECK-NEXT: [tmp180, tmp177, tmp183, tmp162, tmp157, tmp150, tmp146, tmp140, tmp] -> { Stmt_bb203[i0, i1, i2] -> MemRef_tmp173[o0, 1 + i1, 1 + i2] : 3*floor((-i0 + o0)/3) = -i0 + o0 and 0 <= o0 <= 2 }; +; CHECK-NEXT: [tmp180, tmp177, tmp183, tmp162, tmp157, tmp150, tmp146, tmp140, tmp] -> { Stmt_bb203[i0, i1, i2] -> MemRef_tmp173[o0, 1 + i1, 1 + i2] : (-i0 + o0) mod 3 = 0 and 0 <= o0 <= 2 } ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1] ; CHECK-NEXT: [tmp180, tmp177, tmp183, tmp162, tmp157, tmp150, tmp146, tmp140, tmp] -> { Stmt_bb203[i0, i1, i2] -> MemRef_tmp194[] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0] -; CHECK-NEXT: [tmp180, tmp177, tmp183, tmp162, tmp157, tmp150, tmp146, tmp140, tmp] -> { Stmt_bb203[i0, i1, i2] -> MemRef_tmp173[o0, 1 + i1, 1 + i2] : 3*floor((1 - i0 + o0)/3) = 1 - i0 + o0 and 0 <= o0 <= 2 }; +; CHECK-NEXT: [tmp180, tmp177, tmp183, tmp162, tmp157, tmp150, tmp146, tmp140, tmp] -> { Stmt_bb203[i0, i1, i2] -> MemRef_tmp173[o0, 1 + i1, 1 + i2] : (1 - i0 + o0) mod 3 = 0 and 0 <= o0 <= 2 } ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0] ; CHECK-NEXT: [tmp180, tmp177, tmp183, tmp162, tmp157, tmp150, tmp146, tmp140, tmp] -> { Stmt_bb203[i0, i1, i2] -> MemRef_arg56[1 + i0, 1 + i1, 1 + i2] }; ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] diff --git a/polly/test/ScopInfo/multidim_srem.ll b/polly/test/ScopInfo/multidim_srem.ll index 61a7307e56ab..d385f941f1fa 100644 --- a/polly/test/ScopInfo/multidim_srem.ll +++ b/polly/test/ScopInfo/multidim_srem.ll @@ -14,9 +14,9 @@ ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [n] -> { Stmt_for_body_8[i0, i1, i2] -> [i0, i1, i2] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0] -; CHECK-NEXT: [n] -> { Stmt_for_body_8[i0, i1, i2] -> MemRef_A[o0, i1, i2] : 2*floor((i0 + o0)/2) = i0 + o0 and 0 <= o0 <= 1 }; +; CHECK-NEXT: [n] -> { Stmt_for_body_8[i0, i1, i2] -> MemRef_A[o0, i1, i2] : (i0 + o0) mod 2 = 0 and 0 <= o0 <= 1 } ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] -; CHECK-NEXT: [n] -> { Stmt_for_body_8[i0, i1, i2] -> MemRef_A[o0, i1, i2] : 2*floor((i0 + o0)/2) = i0 + o0 and 0 <= o0 <= 1 }; +; CHECK-NEXT: [n] -> { Stmt_for_body_8[i0, i1, i2] -> MemRef_A[o0, i1, i2] : (i0 + o0) mod 2 = 0 and 0 <= o0 <= 1 }; ; CHECK-NEXT: } target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/polly/test/ScopInfo/multiple-types-two-dimensional-2.ll b/polly/test/ScopInfo/multiple-types-two-dimensional-2.ll index 116bdac3ff87..19c33f2b4685 100644 --- a/polly/test/ScopInfo/multiple-types-two-dimensional-2.ll +++ b/polly/test/ScopInfo/multiple-types-two-dimensional-2.ll @@ -12,7 +12,7 @@ ; We do not yet correctly handle multi-dimensional arrays which are accessed ; through different base types. Verify that we correctly bail out. ; -; CHECK: Delinearization assumption: { : 1 = 0 } +; CHECK: Delinearization assumption: { : false } ; target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/polly/test/ScopInfo/multiple-types-two-dimensional.ll b/polly/test/ScopInfo/multiple-types-two-dimensional.ll index 5885595c2eb1..272f727ffe6f 100644 --- a/polly/test/ScopInfo/multiple-types-two-dimensional.ll +++ b/polly/test/ScopInfo/multiple-types-two-dimensional.ll @@ -11,7 +11,7 @@ ; We do not yet correctly handle multi-dimensional arrays which are accessed ; through different base types. Verify that we correctly bail out. ; -; CHECK: Delinearization assumption: { : 1 = 0 } +; CHECK: Delinearization assumption: { : false } target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/polly/test/ScopInfo/non-precise-inv-load-5.ll b/polly/test/ScopInfo/non-precise-inv-load-5.ll index 886d1b190a4e..bc7942dc58c7 100644 --- a/polly/test/ScopInfo/non-precise-inv-load-5.ll +++ b/polly/test/ScopInfo/non-precise-inv-load-5.ll @@ -7,13 +7,13 @@ ; CHECK: Invariant Accesses: { ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0] ; CHECK-NEXT: [c] -> { Stmt_if_then[i0] -> MemRef_I[-129] }; -; CHECK-NEXT: Execution Context: [c] -> { : 1 = 0 } +; CHECK-NEXT: Execution Context: [c] -> { : false } ; CHECK-NEXT: } ; ; TODO: FIXME: We should remove the statement as it has an empty domain. ; CHECK: Stmt_if_then ; CHECK-NEXT: Domain := -; CHECK-NEXT: [c] -> { Stmt_if_then[i0] : 1 = 0 }; +; CHECK-NEXT: [c] -> { Stmt_if_then[i0] : false }; ; ; int I[1024]; ; void f(int *A, unsigned char c) { diff --git a/polly/test/ScopInfo/partially_invariant_load_2.ll b/polly/test/ScopInfo/partially_invariant_load_2.ll index 4269c3270d36..ad891fce5167 100644 --- a/polly/test/ScopInfo/partially_invariant_load_2.ll +++ b/polly/test/ScopInfo/partially_invariant_load_2.ll @@ -6,7 +6,7 @@ ; CHECK-NEXT: } ; ; CHECK: Invalid Context: -; CHECK-NEXT: [N, p] -> { : 1 = 0 } +; CHECK-NEXT: [N, p] -> { : false } ; ; CHECK: Stmt_if_then__TO__if_end ; CHECK-NEXT: Domain := diff --git a/polly/test/ScopInfo/pointer-comparison-no-nsw.ll b/polly/test/ScopInfo/pointer-comparison-no-nsw.ll index 4b644af78bae..232e11960416 100644 --- a/polly/test/ScopInfo/pointer-comparison-no-nsw.ll +++ b/polly/test/ScopInfo/pointer-comparison-no-nsw.ll @@ -8,10 +8,10 @@ ; } ; ; CHECK: Invalid Context: -; CHECK-NEXT: [A, B] -> { : (4*floor((A - B)/4) < A - B) or (4*floor((-A + B)/4) = -A + B and B >= 9223372036854775808 + A) or (4*floor((-A + B)/4) = -A + B and B <= -4 + A) } +; CHECK-NEXT: [A, B] -> { : (4*floor((A - B)/4) < A - B) or ((-A + B) mod 4 = 0 and B >= 9223372036854775808 + A) or ((-A + B) mod 4 = 0 and B <= -4 + A) } ; ; CHECK: Domain := -; CHECK-NEXT: [A, B] -> { Stmt_while_body[i0] : 4*floor((-A + B)/4) = -A + B and i0 >= 0 and 4i0 <= -4 - A + B } +; CHECK-NEXT: [A, B] -> { Stmt_while_body[i0] : (-A + B) mod 4 = 0 and i0 >= 0 and 4i0 <= -4 - A + B } ; target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/polly/test/ScopInfo/pointer-comparison.ll b/polly/test/ScopInfo/pointer-comparison.ll index d7ce6d23509c..148545e976d6 100644 --- a/polly/test/ScopInfo/pointer-comparison.ll +++ b/polly/test/ScopInfo/pointer-comparison.ll @@ -10,10 +10,10 @@ ; } ; ; CHECK: Invalid Context: -; CHECK-NEXT: [A, B] -> { : (4*floor((A - B)/4) < A - B) or (4*floor((-A + B)/4) = -A + B and B >= 9223372036854775808 + A) or (4*floor((-A + B)/4) = -A + B and B <= -4 + A) } +; CHECK-NEXT: [A, B] -> { : (4*floor((A - B)/4) < A - B) or ((-A + B) mod 4 = 0 and B >= 9223372036854775808 + A) or ((-A + B) mod 4 = 0 and B <= -4 + A) } ; ; CHECK: Domain := -; CHECK-NEXT: [A, B] -> { Stmt_while_body[i0] : 4*floor((-A + B)/4) = -A + B and i0 >= 0 and 4i0 <= -4 - A + B } +; CHECK-NEXT: [A, B] -> { Stmt_while_body[i0] : (-A + B) mod 4 = 0 and i0 >= 0 and 4i0 <= -4 - A + B }; ; target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/polly/test/ScopInfo/pointer-type-expressions.ll b/polly/test/ScopInfo/pointer-type-expressions.ll index 36abd9e21057..1db2733e1606 100644 --- a/polly/test/ScopInfo/pointer-type-expressions.ll +++ b/polly/test/ScopInfo/pointer-type-expressions.ll @@ -35,7 +35,7 @@ return: ; CHECK: Assumed Context: ; CHECK-NEXT: { : } ; CHECK-NEXT: Invalid Context: -; CHECK-NEXT: { : 1 = 0 } +; CHECK-NEXT: { : false } ; CHECK: Stmt_store ; CHECK: Domain := diff --git a/polly/test/ScopInfo/process_added_dimensions.ll b/polly/test/ScopInfo/process_added_dimensions.ll index 7dd2daf8b299..276cf755c10a 100644 --- a/polly/test/ScopInfo/process_added_dimensions.ll +++ b/polly/test/ScopInfo/process_added_dimensions.ll @@ -5,7 +5,7 @@ ; CHECK: Assumed Context: ; CHECK-NEXT: { : } ; CHECK: Invalid Context: -; CHECK-NEXT: { : 1 = 0 } +; CHECK-NEXT: { : false } ; CHECK: Statements { ; CHECK-NEXT: Stmt_for_cond40_preheader_4 ; CHECK-NEXT: Domain := diff --git a/polly/test/ScopInfo/ranged_parameter_2.ll b/polly/test/ScopInfo/ranged_parameter_2.ll index c2d6f576efa2..d3c0a2522d45 100644 --- a/polly/test/ScopInfo/ranged_parameter_2.ll +++ b/polly/test/ScopInfo/ranged_parameter_2.ll @@ -4,7 +4,7 @@ ; REQUIRES: asserts ; CHECK: Region: %bb1---%bb16 -; CHECK: [n] -> { : 1 = 0 } +; CHECK: [n] -> { : false } ; This test case at some point caused an assertion when modeling a scop, due ; to use constructing an invalid lower and upper bound for the range of diff --git a/polly/test/ScopInfo/simple_loop_unsigned.ll b/polly/test/ScopInfo/simple_loop_unsigned.ll index c43e21e76cdb..88fdefcb116c 100644 --- a/polly/test/ScopInfo/simple_loop_unsigned.ll +++ b/polly/test/ScopInfo/simple_loop_unsigned.ll @@ -10,7 +10,7 @@ ; CHECK: Assumed Context: ; CHECK-NEXT: [N] -> { : } ; CHECK-NEXT: Invalid Context: -; CHECK-NEXT: [N] -> { : 1 = 0 } +; CHECK-NEXT: [N] -> { : false } ; ; CHECK: Domain := ; CHECK-NEXT: [N] -> { Stmt_bb[i0] : 0 <= i0 < N; Stmt_bb[0] : N = 0 }; diff --git a/polly/test/ScopInfo/switch-1.ll b/polly/test/ScopInfo/switch-1.ll index ca63b3ef8ba0..e63d6d2a15d5 100644 --- a/polly/test/ScopInfo/switch-1.ll +++ b/polly/test/ScopInfo/switch-1.ll @@ -21,7 +21,7 @@ ; CHECK: Statements { ; CHECK-NEXT: Stmt_sw_bb_1 ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] : 4*floor((-1 + i0)/4) = -1 + i0 and 0 < i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] : (-1 + i0) mod 4 = 0 and 0 < i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] -> [i0, 2] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] @@ -30,7 +30,7 @@ ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] -> MemRef_A[i0] }; ; CHECK-NEXT: Stmt_sw_bb_2 ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] : 4*floor((2 + i0)/4) = 2 + i0 and 2 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] : (2 + i0) mod 4 = 0 and 2 <= i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] -> [i0, 1] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] @@ -39,7 +39,7 @@ ; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] -> MemRef_A[i0] }; ; CHECK-NEXT: Stmt_sw_bb_6 ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb_6[i0] : 4*floor((1 + i0)/4) = 1 + i0 and 3 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb_6[i0] : (1 + i0) mod 4 = 0 and 3 <= i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb_6[i0] -> [i0, 0] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] diff --git a/polly/test/ScopInfo/switch-2.ll b/polly/test/ScopInfo/switch-2.ll index 106051975843..116c65fa5b62 100644 --- a/polly/test/ScopInfo/switch-2.ll +++ b/polly/test/ScopInfo/switch-2.ll @@ -20,7 +20,7 @@ ; CHECK: Statements { ; CHECK-NEXT: Stmt_sw_bb ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] : 4*floor((i0)/4) = i0 and 0 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] : (i0) mod 4 = 0 and 0 <= i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] -> [i0, 1] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] @@ -29,7 +29,7 @@ ; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] -> MemRef_A[i0] }; ; CHECK-NEXT: Stmt_sw_bb_2 ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] : 4*floor((2 + i0)/4) = 2 + i0 and 2 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] : (2 + i0) mod 4 = 0 and 2 <= i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] -> [i0, 0] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] diff --git a/polly/test/ScopInfo/switch-3.ll b/polly/test/ScopInfo/switch-3.ll index c32ce109bcc5..13171667fdc3 100644 --- a/polly/test/ScopInfo/switch-3.ll +++ b/polly/test/ScopInfo/switch-3.ll @@ -20,7 +20,7 @@ ; CHECK: Statements { ; CHECK-NEXT: Stmt_sw_bb ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] : 4*floor((i0)/4) = i0 and 0 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] : (i0) mod 4 = 0 and 0 <= i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] -> [i0, 2] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] @@ -38,7 +38,7 @@ ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] -> MemRef_A[i0] }; ; CHECK-NEXT: Stmt_sw_bb_5 ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb_5[i0] : 4*floor((2 + i0)/4) = 2 + i0 and 2 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb_5[i0] : (2 + i0) mod 4 = 0 and 2 <= i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb_5[i0] -> [i0, 0] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] diff --git a/polly/test/ScopInfo/switch-4.ll b/polly/test/ScopInfo/switch-4.ll index 19644aaf924b..02a917a2c030 100644 --- a/polly/test/ScopInfo/switch-4.ll +++ b/polly/test/ScopInfo/switch-4.ll @@ -24,7 +24,7 @@ ; CHECK: Statements { ; CHECK-NEXT: Stmt_sw_bb ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] : 4*floor((i0)/4) = i0 and 0 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] : (i0) mod 4 = 0 and 0 <= i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] -> [i0, 3] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] @@ -33,7 +33,7 @@ ; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] -> MemRef_A[i0] }; ; CHECK-NEXT: Stmt_sw_bb_1 ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] : 4*floor((-1 + i0)/4) = -1 + i0 and 0 < i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] : (-1 + i0) mod 4 = 0 and 0 < i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] -> [i0, 2] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] @@ -42,7 +42,7 @@ ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] -> MemRef_A[i0] }; ; CHECK-NEXT: Stmt_sw_bb_5 ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb_5[i0] : 4*floor((2 + i0)/4) = 2 + i0 and 2 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb_5[i0] : (2 + i0) mod 4 = 0 and 2 <= i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb_5[i0] -> [i0, 1] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] @@ -51,7 +51,7 @@ ; CHECK-NEXT: [N] -> { Stmt_sw_bb_5[i0] -> MemRef_A[i0] }; ; CHECK-NEXT: Stmt_sw_bb_9 ; CHECK-NEXT: Domain := -; CHECK-NEXT: [N] -> { Stmt_sw_bb_9[i0] : 4*floor((1 + i0)/4) = 1 + i0 and 3 <= i0 < N }; +; CHECK-NEXT: [N] -> { Stmt_sw_bb_9[i0] : (1 + i0) mod 4 = 0 and 3 <= i0 < N }; ; CHECK-NEXT: Schedule := ; CHECK-NEXT: [N] -> { Stmt_sw_bb_9[i0] -> [i0, 0] }; ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] diff --git a/polly/test/ScopInfo/user_provided_assumptions-in-bb-signed-conditional.ll b/polly/test/ScopInfo/user_provided_assumptions-in-bb-signed-conditional.ll index c357f7e6e574..04d796d44434 100644 --- a/polly/test/ScopInfo/user_provided_assumptions-in-bb-signed-conditional.ll +++ b/polly/test/ScopInfo/user_provided_assumptions-in-bb-signed-conditional.ll @@ -8,7 +8,7 @@ ; CHECK-NEXT: Assumed Context: ; CHECK-NEXT: [n, b] -> { : } ; CHECK-NEXT: Invalid Context: -; CHECK-NEXT: [n, b] -> { : 1 = 0 } +; CHECK-NEXT: [n, b] -> { : false } ; ; void foo(float A[][100], long b, long n) { diff --git a/polly/test/ScopInfo/user_provided_assumptions.ll b/polly/test/ScopInfo/user_provided_assumptions.ll index 4e063417b34b..78728a112ec1 100644 --- a/polly/test/ScopInfo/user_provided_assumptions.ll +++ b/polly/test/ScopInfo/user_provided_assumptions.ll @@ -13,7 +13,7 @@ ; SCOP: Assumed Context: ; SCOP-NEXT: [N, M, Debug] -> { : } ; SCOP: Invalid Context: -; SCOP-NEXT: [N, M, Debug] -> { : 1 = 0 } +; SCOP-NEXT: [N, M, Debug] -> { : false } ; ; #include ; diff --git a/polly/test/ScopInfo/user_provided_assumptions_2.ll b/polly/test/ScopInfo/user_provided_assumptions_2.ll index 4636ef417c15..0d2280e31182 100644 --- a/polly/test/ScopInfo/user_provided_assumptions_2.ll +++ b/polly/test/ScopInfo/user_provided_assumptions_2.ll @@ -10,7 +10,7 @@ ; SCOP: Assumed Context: ; SCOP-NEXT: [N, M] -> { : } ; SCOP: Invalid Context: -; SCOP-NEXT: [N, M] -> { : 1 = 0 } +; SCOP-NEXT: [N, M] -> { : false } ; ; ; This test checks that assumptions over parameters not used in the Scop are diff --git a/polly/test/ScopInfo/user_provided_assumptions_3.ll b/polly/test/ScopInfo/user_provided_assumptions_3.ll index f16df2192183..8bdb689872a6 100644 --- a/polly/test/ScopInfo/user_provided_assumptions_3.ll +++ b/polly/test/ScopInfo/user_provided_assumptions_3.ll @@ -10,7 +10,7 @@ ; SCOP: Assumed Context: ; SCOP-NEXT: [N, M] -> { : } ; SCOP: Invalid Context: -; SCOP-NEXT: [N, M] -> { : 1 = 0 } +; SCOP-NEXT: [N, M] -> { : false } ; ; int f(int *A, int N, int M) { ; __builtin_assume(M > 0 && N > M); diff --git a/polly/test/ScopInfo/wraping_signed_expr_1.ll b/polly/test/ScopInfo/wraping_signed_expr_1.ll index 71a60ac38d63..2e5fc0dd709e 100644 --- a/polly/test/ScopInfo/wraping_signed_expr_1.ll +++ b/polly/test/ScopInfo/wraping_signed_expr_1.ll @@ -21,7 +21,7 @@ ; ; CHECK: Function: nowrap ; CHECK: Invalid Context: -; CHECK-NEXT: [N] -> { : 1 = 0 } +; CHECK-NEXT: [N] -> { : false } ; target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"