From: Tobias Grosser Date: Sat, 27 May 2017 11:09:39 +0000 (+0000) Subject: Update isl to isl-0.18-662-g17e172e X-Git-Tag: llvmorg-5.0.0-rc1~4099 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ea64d8bd3c530e97fbfb47c87a4b7cfd206284a;p=platform%2Fupstream%2Fllvm.git Update isl to isl-0.18-662-g17e172e This is a general maintenance update llvm-svn: 304069 --- diff --git a/polly/lib/External/isl/GIT_HEAD_ID b/polly/lib/External/isl/GIT_HEAD_ID index 71f27bd..2854317 100644 --- a/polly/lib/External/isl/GIT_HEAD_ID +++ b/polly/lib/External/isl/GIT_HEAD_ID @@ -1 +1 @@ -isl-0.18-592-gb50ad59 +isl-0.18-662-g17e172e diff --git a/polly/lib/External/isl/Makefile.am b/polly/lib/External/isl/Makefile.am index 82eb1ed..11ebd7d 100644 --- a/polly/lib/External/isl/Makefile.am +++ b/polly/lib/External/isl/Makefile.am @@ -389,6 +389,7 @@ EXTRA_DIST = \ imath/imrat.c \ imath/imrat.h \ interface/all.h \ + interface/isl.h.top \ interface/isl.py.top \ test_inputs diff --git a/polly/lib/External/isl/Makefile.in b/polly/lib/External/isl/Makefile.in index 9486064..2c8f479 100644 --- a/polly/lib/External/isl/Makefile.in +++ b/polly/lib/External/isl/Makefile.in @@ -114,6 +114,8 @@ 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 \ @@ -686,6 +688,7 @@ CLANG_LIBS = @CLANG_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ +CXX11FLAGS = @CXX11FLAGS@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -705,6 +708,7 @@ 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@ @@ -1159,6 +1163,7 @@ EXTRA_DIST = \ imath/imrat.c \ imath/imrat.h \ interface/all.h \ + interface/isl.h.top \ interface/isl.py.top \ test_inputs diff --git a/polly/lib/External/isl/aclocal.m4 b/polly/lib/External/isl/aclocal.m4 index 7fc091f..638fadd 100644 --- a/polly/lib/External/isl/aclocal.m4 +++ b/polly/lib/External/isl/aclocal.m4 @@ -1156,6 +1156,8 @@ 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/configure b/polly/lib/External/isl/configure index 72ce93c..8de9fd3 100755 --- a/polly/lib/External/isl/configure +++ b/polly/lib/External/isl/configure @@ -650,6 +650,8 @@ 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 @@ -688,6 +690,8 @@ EGREP GREP SED LIBTOOL +HAVE_CXX11 +CXX11FLAGS PRTDIAG host_os host_vendor @@ -5921,6 +5925,682 @@ $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" + case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 @@ -9620,7 +10300,6 @@ done - func_stripname_cnf () { case $2 in @@ -18156,6 +18835,14 @@ 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='#' @@ -18564,7 +19251,7 @@ if test "$llvm_config_found" != yes; then as_fn_error $? "llvm-config not found" "$LINENO" 5 fi CLANG_CXXFLAGS=`$llvm_config --cxxflags | \ - $SED -e 's/-Wcovered-switch-default//'` + $SED -e 's/-Wcovered-switch-default//;s/-gsplit-dwarf//'` CLANG_LDFLAGS=`$llvm_config --ldflags` targets=`$llvm_config --targets-built` components="$targets asmparser bitreader support mc" @@ -19477,6 +20164,10 @@ 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 1601849..7e87015 100644 --- a/polly/lib/External/isl/configure.ac +++ b/polly/lib/External/isl/configure.ac @@ -25,6 +25,17 @@ 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_LIBTOOL AC_CHECK_PROG(PERL, perl, perl, []) @@ -66,6 +77,7 @@ 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 c02eb18..b5d1905 100644 --- a/polly/lib/External/isl/doc/Makefile.in +++ b/polly/lib/External/isl/doc/Makefile.in @@ -95,6 +95,8 @@ 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 \ @@ -153,6 +155,7 @@ CLANG_LIBS = @CLANG_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ +CXX11FLAGS = @CXX11FLAGS@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -172,6 +175,7 @@ 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@ diff --git a/polly/lib/External/isl/doc/user.pod b/polly/lib/External/isl/doc/user.pod index 8bd9e1e..b012ddf 100644 --- a/polly/lib/External/isl/doc/user.pod +++ b/polly/lib/External/isl/doc/user.pod @@ -3966,7 +3966,7 @@ To check whether a set is a parameter domain, use this function: =item * Wrapping The following functions check whether the space of the given -(basic) set or relation range is a wrapped relation. +(basic) set or relation domain and/or range is a wrapped relation. #include isl_bool isl_space_is_wrapping( @@ -3975,6 +3975,8 @@ The following functions check whether the space of the given __isl_keep isl_space *space); isl_bool isl_space_range_is_wrapping( __isl_keep isl_space *space); + isl_bool isl_space_is_product( + __isl_keep isl_space *space); #include isl_bool isl_basic_set_is_wrapping( @@ -3986,6 +3988,7 @@ The following functions check whether the space of the given __isl_keep isl_map *map); isl_bool isl_map_range_is_wrapping( __isl_keep isl_map *map); + isl_bool isl_map_is_product(__isl_keep isl_map *map); #include isl_bool isl_multi_val_range_is_wrapping( @@ -4003,6 +4006,10 @@ The input to C should be the space of a set, while that of C and C should be the space of a relation. +The input to C can be either the space +of a set or that of a binary relation. +In case the input is the space of a binary relation, it checks +whether both domain and range are wrapping. =item * Internal Product @@ -9343,7 +9350,7 @@ and C. If this option is set, then we try to construct schedules in which the constant term is split off from the linear part if the linear parts of -the scheduling rows for all nodes in the graphs have a common non-trivial +the scheduling rows for all nodes in the graph have a common non-trivial divisor. The constant term is then placed in a separate band and the linear part is reduced. diff --git a/polly/lib/External/isl/include/isl/map.h b/polly/lib/External/isl/include/isl/map.h index 1e3e8bd..433374a 100644 --- a/polly/lib/External/isl/include/isl/map.h +++ b/polly/lib/External/isl/include/isl/map.h @@ -28,20 +28,6 @@ extern "C" { #endif -/* General notes: - * - * All structures are reference counted to allow reuse without duplication. - * A *_copy operation will increase the reference count, while a *_free - * operation will decrease the reference count and only actually release - * the structures when the reference count drops to zero. - * - * Functions that return an isa structure will in general _destroy_ - * all argument isa structures (the obvious execption begin the _copy - * functions). A pointer passed to such a function may therefore - * never be used after the function call. If you want to keep a - * reference to the old structure(s), use the appropriate _copy function. - */ - ISL_DEPRECATED unsigned isl_basic_map_n_in(__isl_keep const isl_basic_map *bmap); ISL_DEPRECATED @@ -367,6 +353,7 @@ __isl_give isl_map *isl_map_flat_range_product(__isl_take isl_map *map1, __isl_take isl_map *map2); isl_bool isl_map_domain_is_wrapping(__isl_keep isl_map *map); isl_bool isl_map_range_is_wrapping(__isl_keep isl_map *map); +isl_bool isl_map_is_product(__isl_keep isl_map *map); __isl_give isl_map *isl_map_factor_domain(__isl_take isl_map *map); __isl_give isl_map *isl_map_factor_range(__isl_take isl_map *map); __isl_give isl_map *isl_map_domain_factor_domain(__isl_take isl_map *map); diff --git a/polly/lib/External/isl/include/isl/space.h b/polly/lib/External/isl/include/isl/space.h index ce25ff6..78a1818 100644 --- a/polly/lib/External/isl/include/isl/space.h +++ b/polly/lib/External/isl/include/isl/space.h @@ -135,10 +135,11 @@ __isl_give isl_space *isl_space_align_params(__isl_take isl_space *dim1, isl_bool isl_space_is_wrapping(__isl_keep isl_space *dim); isl_bool isl_space_domain_is_wrapping(__isl_keep isl_space *space); isl_bool isl_space_range_is_wrapping(__isl_keep isl_space *space); +isl_bool isl_space_is_product(__isl_keep isl_space *space); __isl_give isl_space *isl_space_wrap(__isl_take isl_space *dim); __isl_give isl_space *isl_space_unwrap(__isl_take isl_space *dim); -isl_bool isl_space_can_zip(__isl_keep isl_space *dim); +isl_bool isl_space_can_zip(__isl_keep isl_space *space); __isl_give isl_space *isl_space_zip(__isl_take isl_space *dim); isl_bool isl_space_can_curry(__isl_keep isl_space *space); diff --git a/polly/lib/External/isl/interface/isl.h.top b/polly/lib/External/isl/interface/isl.h.top new file mode 100644 index 0000000..37749c295 --- /dev/null +++ b/polly/lib/External/isl/interface/isl.h.top @@ -0,0 +1,95 @@ +/// 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.py.top b/polly/lib/External/isl/interface/isl.py.top index 6d4ae49..71c2b0d 100644 --- a/polly/lib/External/isl/interface/isl.py.top +++ b/polly/lib/External/isl/interface/isl.py.top @@ -17,7 +17,7 @@ class Context: isl.isl_ctx_free(self) def from_param(self): - return self.ptr + return c_void_p(self.ptr) @staticmethod def getDefaultInstance(): diff --git a/polly/lib/External/isl/isl_coalesce.c b/polly/lib/External/isl/isl_coalesce.c index c2dc313..476f815 100644 --- a/polly/lib/External/isl/isl_coalesce.c +++ b/polly/lib/External/isl/isl_coalesce.c @@ -59,7 +59,7 @@ static int status_in(isl_int *ineq, struct isl_tab *tab) /* Compute the position of the equalities of basic map "bmap_i" * with respect to the basic map represented by "tab_j". * The resulting array has twice as many entries as the number - * of equalities corresponding to the two inequalties to which + * of equalities corresponding to the two inequalities to which * each equality corresponds. */ static int *eq_status_in(__isl_keep isl_basic_map *bmap_i, diff --git a/polly/lib/External/isl/isl_config.h.in b/polly/lib/External/isl/isl_config.h.in index e9d1eac..e800692 100644 --- a/polly/lib/External/isl/isl_config.h.in +++ b/polly/lib/External/isl/isl_config.h.in @@ -34,6 +34,9 @@ /* 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_flow.c b/polly/lib/External/isl/isl_flow.c index 2b0330b..691f4be 100644 --- a/polly/lib/External/isl/isl_flow.c +++ b/polly/lib/External/isl/isl_flow.c @@ -749,7 +749,7 @@ static __isl_give isl_map *all_sources(__isl_keep isl_access_info *acc, } /* For a given mapping between iterations of must source k and iterations - * of the sink, compute the all iteration of may source j preceding + * of the sink, compute all iterations of may source j preceding * the sink at level before_level for any of the sink iterations, * but following the corresponding iteration of must source k at level * after_level. @@ -2557,7 +2557,7 @@ error: * domain elements of access->sink. * * We check whether the schedule is available as a schedule tree - * or a schedule map and call the correpsonding function to perform + * or a schedule map and call the corresponding function to perform * the analysis. */ __isl_give isl_union_flow *isl_union_access_info_compute_flow( diff --git a/polly/lib/External/isl/isl_list_templ.c b/polly/lib/External/isl/isl_list_templ.c index 8429227..ebfd648 100644 --- a/polly/lib/External/isl/isl_list_templ.c +++ b/polly/lib/External/isl/isl_list_templ.c @@ -282,7 +282,7 @@ isl_stat FN(LIST(EL),foreach)(__isl_keep LIST(EL) *list, return isl_stat_error; for (i = 0; i < list->n; ++i) { - EL *el = FN(EL,copy(list->p[i])); + EL *el = FN(EL,copy)(list->p[i]); if (!el) return isl_stat_error; if (fn(el, user) < 0) diff --git a/polly/lib/External/isl/isl_map.c b/polly/lib/External/isl/isl_map.c index 68ecd96..18e8874 100644 --- a/polly/lib/External/isl/isl_map.c +++ b/polly/lib/External/isl/isl_map.c @@ -209,6 +209,42 @@ unsigned isl_map_n_param(__isl_keep const isl_map *map) return map ? map->dim->nparam : 0; } +/* Return the number of equality constraints in the description of "bmap". + * Return -1 on error. + */ +int isl_basic_map_n_equality(__isl_keep isl_basic_map *bmap) +{ + if (!bmap) + return -1; + return bmap->n_eq; +} + +/* Return the number of equality constraints in the description of "bset". + * Return -1 on error. + */ +int isl_basic_set_n_equality(__isl_keep isl_basic_set *bset) +{ + return isl_basic_map_n_equality(bset_to_bmap(bset)); +} + +/* Return the number of inequality constraints in the description of "bmap". + * Return -1 on error. + */ +int isl_basic_map_n_inequality(__isl_keep isl_basic_map *bmap) +{ + if (!bmap) + return -1; + return bmap->n_ineq; +} + +/* Return the number of inequality constraints in the description of "bset". + * Return -1 on error. + */ +int isl_basic_set_n_inequality(__isl_keep isl_basic_set *bset) +{ + return isl_basic_map_n_inequality(bset_to_bmap(bset)); +} + /* Do "bmap1" and "bmap2" have the same parameters? */ static isl_bool isl_basic_map_has_equal_params(__isl_keep isl_basic_map *bmap1, @@ -11188,6 +11224,13 @@ isl_bool isl_map_domain_is_wrapping(__isl_keep isl_map *map) return isl_space_domain_is_wrapping(map->dim); } +/* Does "map" have a wrapped relation in both domain and range? + */ +isl_bool isl_map_is_product(__isl_keep isl_map *map) +{ + return isl_space_is_product(isl_map_peek_space(map)); +} + /* Is the range of "map" a wrapped relation? */ isl_bool isl_map_range_is_wrapping(__isl_keep isl_map *map) diff --git a/polly/lib/External/isl/isl_map_private.h b/polly/lib/External/isl/isl_map_private.h index 2b976ab..7923446 100644 --- a/polly/lib/External/isl/isl_map_private.h +++ b/polly/lib/External/isl/isl_map_private.h @@ -430,6 +430,11 @@ __isl_give isl_basic_set *isl_basic_set_expand_divs( __isl_give isl_basic_map *isl_basic_map_expand_divs( __isl_take isl_basic_set *bmap, __isl_take isl_mat *div, int *exp); +int isl_basic_set_n_equality(__isl_keep isl_basic_set *bset); +int isl_basic_map_n_equality(__isl_keep isl_basic_map *bmap); +int isl_basic_set_n_inequality(__isl_keep isl_basic_set *bset); +int isl_basic_map_n_inequality(__isl_keep isl_basic_map *bmap); + __isl_give isl_basic_map *isl_basic_map_mark_div_unknown( __isl_take isl_basic_map *bmap, int div); isl_bool isl_basic_map_div_is_marked_unknown(__isl_keep isl_basic_map *bmap, diff --git a/polly/lib/External/isl/isl_map_simplify.c b/polly/lib/External/isl/isl_map_simplify.c index d59ec86..32a9874 100644 --- a/polly/lib/External/isl/isl_map_simplify.c +++ b/polly/lib/External/isl/isl_map_simplify.c @@ -3847,7 +3847,7 @@ static int is_zero_or_one(isl_int v) * of this second div b and such that in any constraint that contains * a (except for the given lower and upper bound), also contains b * with a coefficient that is m times that of b. - * That is, all constraints (execpt for the lower and upper bound) + * That is, all constraints (except for the lower and upper bound) * are of the form * * e + f (a + m b) >= 0 @@ -4190,7 +4190,7 @@ error: * i.e., the coefficient of div is f. * * Otherwise, we first need to introduce div1 into the constraint. - * Let the l be + * Let l be * * div1 + f >=0 * diff --git a/polly/lib/External/isl/isl_morph.c b/polly/lib/External/isl/isl_morph.c index 5e75dee..9b615f1 100644 --- a/polly/lib/External/isl/isl_morph.c +++ b/polly/lib/External/isl/isl_morph.c @@ -17,6 +17,7 @@ #include #include #include +#include isl_ctx *isl_morph_get_ctx(__isl_keep isl_morph *morph) { @@ -383,8 +384,9 @@ error: return NULL; } -/* Given a basic set, exploit the equalties in the basic set to construct - * a morphishm that maps the basic set to a lower-dimensional space. +/* Given a basic set, exploit the equalities in the basic set to construct + * a morphism that maps the basic set to a lower-dimensional space + * with identifier "id". * Specifically, the morphism reduces the number of dimensions of type "type". * * We first select the equalities of interest, that is those that involve @@ -408,15 +410,16 @@ error: * Both matrices are extended to map the full original space to the full * compressed space. */ -__isl_give isl_morph *isl_basic_set_variable_compression( - __isl_keep isl_basic_set *bset, enum isl_dim_type type) +__isl_give isl_morph *isl_basic_set_variable_compression_with_id( + __isl_keep isl_basic_set *bset, enum isl_dim_type type, + __isl_keep isl_id *id) { unsigned otype; unsigned ntype; unsigned orest; unsigned nrest; int f_eq, n_eq; - isl_space *dim; + isl_space *space; isl_mat *E, *Q, *C; isl_basic_set *dom, *ran; @@ -455,15 +458,27 @@ __isl_give isl_morph *isl_basic_set_variable_compression( Q = isl_mat_diagonal(Q, isl_mat_identity(bset->ctx, nrest)); C = isl_mat_diagonal(C, isl_mat_identity(bset->ctx, nrest)); - dim = isl_space_copy(bset->dim); - dim = isl_space_drop_dims(dim, type, 0, ntype); - dim = isl_space_add_dims(dim, type, ntype - n_eq); - ran = isl_basic_set_universe(dim); + space = isl_space_copy(bset->dim); + space = isl_space_drop_dims(space, type, 0, ntype); + space = isl_space_add_dims(space, type, ntype - n_eq); + space = isl_space_set_tuple_id(space, isl_dim_set, isl_id_copy(id)); + ran = isl_basic_set_universe(space); dom = copy_equalities(bset, f_eq, n_eq); return isl_morph_alloc(dom, ran, Q, C); } +/* Given a basic set, exploit the equalities in the basic set to construct + * a morphism that maps the basic set to a lower-dimensional space. + * Specifically, the morphism reduces the number of dimensions of type "type". + */ +__isl_give isl_morph *isl_basic_set_variable_compression( + __isl_keep isl_basic_set *bset, enum isl_dim_type type) +{ + return isl_basic_set_variable_compression_with_id(bset, type, + &isl_id_none); +} + /* Construct a parameter compression for "bset". * We basically just call isl_mat_parameter_compression with the right input * and then extend the resulting matrix to include the variables. @@ -773,7 +788,7 @@ __isl_give isl_morph *isl_morph_inverse(__isl_take isl_morph *morph) return morph; } -/* We detect all the equalities first to avoid implicit equalties +/* We detect all the equalities first to avoid implicit equalities * being discovered during the computations. In particular, * the compression on the variables could expose additional stride * constraints on the parameters. This would result in existentially diff --git a/polly/lib/External/isl/isl_morph.h b/polly/lib/External/isl/isl_morph.h index 8c8d236..8ded753 100644 --- a/polly/lib/External/isl/isl_morph.h +++ b/polly/lib/External/isl/isl_morph.h @@ -67,6 +67,9 @@ void isl_morph_dump(__isl_take isl_morph *morph); __isl_give isl_morph *isl_basic_set_variable_compression( __isl_keep isl_basic_set *bset, enum isl_dim_type type); +__isl_give isl_morph *isl_basic_set_variable_compression_with_id( + __isl_keep isl_basic_set *bset, enum isl_dim_type type, + __isl_keep isl_id *id); __isl_give isl_morph *isl_basic_set_parameter_compression( __isl_keep isl_basic_set *bset); __isl_give isl_morph *isl_basic_set_full_compression( diff --git a/polly/lib/External/isl/isl_scheduler.c b/polly/lib/External/isl/isl_scheduler.c index e1d0561..4b660ab 100644 --- a/polly/lib/External/isl/isl_scheduler.c +++ b/polly/lib/External/isl/isl_scheduler.c @@ -47,7 +47,8 @@ /* Internal information about a node that is used during the construction * of a schedule. - * space represents the space in which the domain lives + * space represents the original space in which the domain lives; + * that is, the space is not affected by compression * sched is a matrix representation of the schedule being constructed * for this node; if compressed is set, then this schedule is * defined over the compressed domain space @@ -117,12 +118,12 @@ struct isl_sched_node { isl_vec *max; }; -static int node_has_space(const void *entry, const void *val) +static int node_has_tuples(const void *entry, const void *val) { struct isl_sched_node *node = (struct isl_sched_node *)entry; - isl_space *dim = (isl_space *)val; + isl_space *space = (isl_space *) val; - return isl_space_is_equal(node->space, dim); + return isl_space_has_equal_tuples(node->space, space); } static int node_scc_exactly(struct isl_sched_node *node, int scc) @@ -317,7 +318,7 @@ static int is_conditional_validity(struct isl_sched_edge *edge) * a single edge between a given pair of source and sink space * in the entire graph * - * node_table contains pointers into the node array, hashed on the space + * node_table contains pointers into the node array, hashed on the space tuples * * region contains a list of variable sequences that should be non-trivial * @@ -382,9 +383,9 @@ static int graph_init_table(isl_ctx *ctx, struct isl_sched_graph *graph) struct isl_hash_table_entry *entry; uint32_t hash; - hash = isl_space_get_hash(graph->node[i].space); + hash = isl_space_get_tuple_hash(graph->node[i].space); entry = isl_hash_table_find(ctx, graph->node_table, hash, - &node_has_space, + &node_has_tuples, graph->node[i].space, 1); if (!entry) return -1; @@ -398,14 +399,14 @@ static int graph_init_table(isl_ctx *ctx, struct isl_sched_graph *graph) * or NULL if there is no such node. */ static struct isl_sched_node *graph_find_node(isl_ctx *ctx, - struct isl_sched_graph *graph, __isl_keep isl_space *dim) + struct isl_sched_graph *graph, __isl_keep isl_space *space) { struct isl_hash_table_entry *entry; uint32_t hash; - hash = isl_space_get_hash(dim); + hash = isl_space_get_tuple_hash(space); entry = isl_hash_table_find(ctx, graph->node_table, hash, - &node_has_space, dim, 0); + &node_has_tuples, space, 0); return entry ? entry->data : NULL; } @@ -957,16 +958,56 @@ static isl_stat add_node(struct isl_sched_graph *graph, return isl_stat_ok; } +/* Construct an identifier for node "node", which will represent "set". + * The name of the identifier is either "compressed" or + * "compressed_", with the name of the space of "set". + * The user pointer of the identifier points to "node". + */ +static __isl_give isl_id *construct_compressed_id(__isl_keep isl_set *set, + struct isl_sched_node *node) +{ + isl_bool has_name; + isl_ctx *ctx; + isl_id *id; + isl_printer *p; + const char *name; + char *id_name; + + has_name = isl_set_has_tuple_name(set); + if (has_name < 0) + return NULL; + + ctx = isl_set_get_ctx(set); + if (!has_name) + return isl_id_alloc(ctx, "compressed", node); + + p = isl_printer_to_str(ctx); + name = isl_set_get_tuple_name(set); + p = isl_printer_print_str(p, "compressed_"); + p = isl_printer_print_str(p, name); + id_name = isl_printer_get_str(p); + isl_printer_free(p); + + id = isl_id_alloc(ctx, id_name, node); + free(id_name); + + return id; +} + /* Add a new node to the graph representing the given set. * * If any of the set variables is defined by an equality, then * we perform variable compression such that we can perform * the scheduling on the compressed domain. + * In this case, an identifier is used that references the new node + * such that each compressed space is unique and + * such that the node can be recovered from the compressed space. */ static isl_stat extract_node(__isl_take isl_set *set, void *user) { int nvar; isl_bool has_equality; + isl_id *id; isl_basic_set *hull; isl_set *hull_set; isl_morph *morph; @@ -985,7 +1026,10 @@ static isl_stat extract_node(__isl_take isl_set *set, void *user) return add_node(graph, set, nvar, 0, NULL, NULL, NULL); } - morph = isl_basic_set_variable_compression(hull, isl_dim_set); + id = construct_compressed_id(set, &graph->node[graph->n]); + morph = isl_basic_set_variable_compression_with_id(hull, + isl_dim_set, id); + isl_id_free(id); nvar = isl_morph_ran_dim(morph, isl_dim_set); compress = isl_morph_get_var_multi_aff(morph); morph = isl_morph_inverse(morph); @@ -1562,9 +1606,9 @@ static __isl_give isl_dim_map *intra_dim_map(isl_ctx *ctx, * (c_0, c_n, c_x, c_y). * The mapping produced by this function essentially plugs in * (c_j_0 - c_i_0, c_j_n - c_i_n, - * c_j_x^+ - c_j_x^-, -(c_i_x^+ - c_i_x^-)) if s = 1 and + * -(c_i_x^+ - c_i_x^-), c_j_x^+ - c_j_x^-) if s = 1 and * (-c_j_0 + c_i_0, -c_j_n + c_i_n, - * - (c_j_x^+ - c_j_x^-), c_i_x^+ - c_i_x^-) if s = -1. + * c_i_x^+ - c_i_x^-, -(c_j_x^+ - c_j_x^-)) if s = -1. * In graph->lp, the c_*^- appear before their c_*^+ counterpart. * * The caller can further extend the mapping. @@ -1597,6 +1641,22 @@ static __isl_give isl_dim_map *inter_dim_map(isl_ctx *ctx, return dim_map; } +/* Add the constraints from "src" to "dst" using "dim_map", + * after making sure there is enough room in "dst" for the extra constraints. + */ +static __isl_give isl_basic_set *add_constraints_dim_map( + __isl_take isl_basic_set *dst, __isl_take isl_basic_set *src, + __isl_take isl_dim_map *dim_map) +{ + int n_eq, n_ineq; + + n_eq = isl_basic_set_n_equality(src); + n_ineq = isl_basic_set_n_inequality(src); + dst = isl_basic_set_extend_constraints(dst, n_eq, n_ineq); + dst = isl_basic_set_add_constraints_dim_map(dst, src, dim_map); + return dst; +} + /* Add constraints to graph->lp that force validity for the given * dependence from a node i to itself. * That is, add constraints that enforce @@ -1634,10 +1694,7 @@ static isl_stat add_intra_validity_constraints(struct isl_sched_graph *graph, return isl_stat_error; dim_map = intra_dim_map(ctx, graph, node, offset, 1); - graph->lp = isl_basic_set_extend_constraints(graph->lp, - coef->n_eq, coef->n_ineq); - graph->lp = isl_basic_set_add_constraints_dim_map(graph->lp, - coef, dim_map); + graph->lp = add_constraints_dim_map(graph->lp, coef, dim_map); return isl_stat_ok; } @@ -1651,7 +1708,7 @@ static isl_stat add_intra_validity_constraints(struct isl_sched_graph *graph, * for each (x,y) in R. * We obtain general constraints on coefficients (c_0, c_n, c_x, c_y) * of valid constraints for R and then plug in - * (c_j_0 - c_i_0, c_j_n - c_i_n, c_j_x^+ - c_j_x^- - (c_i_x^+ - c_i_x^-)), + * (c_j_0 - c_i_0, c_j_n - c_i_n, -(c_i_x^+ - c_i_x^-), c_j_x^+ - c_j_x^-), * where c_* = c_*^+ - c_*^-, with c_*^+ and c_*^- non-negative. * In graph->lp, the c_*^- appear before their c_*^+ counterpart. * @@ -1663,13 +1720,18 @@ static isl_stat add_inter_validity_constraints(struct isl_sched_graph *graph, struct isl_sched_edge *edge) { int offset; - isl_map *map = isl_map_copy(edge->map); - isl_ctx *ctx = isl_map_get_ctx(map); + isl_map *map; + isl_ctx *ctx; isl_dim_map *dim_map; isl_basic_set *coef; struct isl_sched_node *src = edge->src; struct isl_sched_node *dst = edge->dst; + if (!graph->lp) + return isl_stat_error; + + map = isl_map_copy(edge->map); + ctx = isl_map_get_ctx(map); coef = inter_coefficients(graph, edge, map); offset = coef_var_offset(coef); @@ -1684,10 +1746,7 @@ static isl_stat add_inter_validity_constraints(struct isl_sched_graph *graph, dim_map = inter_dim_map(ctx, graph, src, dst, offset, 1); edge->start = graph->lp->n_ineq; - graph->lp = isl_basic_set_extend_constraints(graph->lp, - coef->n_eq, coef->n_ineq); - graph->lp = isl_basic_set_add_constraints_dim_map(graph->lp, - coef, dim_map); + graph->lp = add_constraints_dim_map(graph->lp, coef, dim_map); if (!graph->lp) return isl_stat_error; edge->end = graph->lp->n_ineq; @@ -1767,10 +1826,7 @@ static isl_stat add_intra_proximity_constraints(struct isl_sched_graph *graph, isl_dim_map_range(dim_map, 4, 2, 1, 1, nparam, -1); isl_dim_map_range(dim_map, 5, 2, 1, 1, nparam, 1); } - graph->lp = isl_basic_set_extend_constraints(graph->lp, - coef->n_eq, coef->n_ineq); - graph->lp = isl_basic_set_add_constraints_dim_map(graph->lp, - coef, dim_map); + graph->lp = add_constraints_dim_map(graph->lp, coef, dim_map); return isl_stat_ok; } @@ -1802,7 +1858,7 @@ static isl_stat add_intra_proximity_constraints(struct isl_sched_graph *graph, * We obtain general constraints on coefficients (c_0, c_n, c_x, c_y) * of valid constraints for R and then plug in * (m_0 - s*c_j_0 + s*c_i_0, m_n - s*c_j_n + s*c_i_n, - * -s*c_j_x+s*c_i_x) + * s*c_i_x, -s*c_j_x) * with each coefficient (except m_0, c_*_0 and c_*_n) * represented as a pair of non-negative coefficients. * @@ -1811,17 +1867,17 @@ static isl_stat add_intra_proximity_constraints(struct isl_sched_graph *graph, * of the columns in node->cmap. * * - * If "local" is set, then we add constraints + * If "local" is set (and s = 1), then we add constraints * * (c_j_0 + c_j_n n + c_j_x y) - (c_i_0 + c_i_n n + c_i_x x) <= 0 * * or * - * -((c_j_0 + c_j_n n + c_j_x y) - (c_i_0 + c_i_n n + c_i_x x)) <= 0 + * -((c_j_0 + c_j_n n + c_j_x y) + (c_i_0 + c_i_n n + c_i_x x)) >= 0 * * instead, forcing the dependence distance to be (less than or) equal to 0. * That is, we plug in - * (-s*c_j_0 + s*c_i_0, -s*c_j_n + s*c_i_n, -s*c_j_x+s*c_i_x). + * (-s*c_j_0 + s*c_i_0, -s*c_j_n + s*c_i_n, s*c_i_x, -s*c_j_x). * Note that dependences marked local are treated as validity constraints * by add_all_validity_constraints and therefore also have * their distances bounded by 0 from below. @@ -1858,10 +1914,7 @@ static isl_stat add_inter_proximity_constraints(struct isl_sched_graph *graph, isl_dim_map_range(dim_map, 5, 2, 1, 1, nparam, 1); } - graph->lp = isl_basic_set_extend_constraints(graph->lp, - coef->n_eq, coef->n_ineq); - graph->lp = isl_basic_set_add_constraints_dim_map(graph->lp, - coef, dim_map); + graph->lp = add_constraints_dim_map(graph->lp, coef, dim_map); return isl_stat_ok; } @@ -1882,7 +1935,7 @@ static int add_all_validity_constraints(struct isl_sched_graph *graph, int i; for (i = 0; i < graph->n_edge; ++i) { - struct isl_sched_edge *edge= &graph->edge[i]; + struct isl_sched_edge *edge = &graph->edge[i]; int local; local = is_local(edge) || @@ -1930,7 +1983,7 @@ static int add_all_proximity_constraints(struct isl_sched_graph *graph, int i; for (i = 0; i < graph->n_edge; ++i) { - struct isl_sched_edge *edge= &graph->edge[i]; + struct isl_sched_edge *edge = &graph->edge[i]; int local; local = is_local(edge) || @@ -2061,8 +2114,8 @@ static isl_stat count_map_constraints(struct isl_sched_graph *graph, coef = inter_coefficients(graph, edge, map); if (!coef) return isl_stat_error; - *n_eq += f * coef->n_eq; - *n_ineq += f * coef->n_ineq; + *n_eq += f * isl_basic_set_n_equality(coef); + *n_ineq += f * isl_basic_set_n_inequality(coef); isl_basic_set_free(coef); return isl_stat_ok; @@ -2086,7 +2139,7 @@ static int count_constraints(struct isl_sched_graph *graph, *n_eq = *n_ineq = 0; for (i = 0; i < graph->n_edge; ++i) { - struct isl_sched_edge *edge= &graph->edge[i]; + struct isl_sched_edge *edge = &graph->edge[i]; isl_map *map = isl_map_copy(edge->map); if (count_map_constraints(graph, edge, map, n_eq, n_ineq, @@ -2143,7 +2196,7 @@ static isl_stat add_bound_constant_constraints(isl_ctx *ctx, k = isl_basic_set_alloc_inequality(graph->lp); if (k < 0) return isl_stat_error; - isl_seq_clr(graph->lp->ineq[k], 1 + total); + isl_seq_clr(graph->lp->ineq[k], 1 + total); isl_int_set_si(graph->lp->ineq[k][1 + node->start], -1); isl_int_set_si(graph->lp->ineq[k][0], max); } @@ -2307,7 +2360,7 @@ static isl_stat add_sum_constraint(struct isl_sched_graph *graph, k = isl_basic_set_alloc_equality(graph->lp); if (k < 0) return isl_stat_error; - isl_seq_clr(graph->lp->eq[k], 1 + total); + isl_seq_clr(graph->lp->eq[k], 1 + total); isl_int_set_si(graph->lp->eq[k][1 + sum_pos], -1); for (i = 0; i < n; ++i) isl_int_set_si(graph->lp->eq[k][1 + first + i], 1); @@ -2334,7 +2387,7 @@ static isl_stat add_param_sum_constraint(struct isl_sched_graph *graph, k = isl_basic_set_alloc_equality(graph->lp); if (k < 0) return isl_stat_error; - isl_seq_clr(graph->lp->eq[k], 1 + total); + isl_seq_clr(graph->lp->eq[k], 1 + total); isl_int_set_si(graph->lp->eq[k][1 + sum_pos], -1); for (i = 0; i < graph->n; ++i) { int pos = 1 + graph->node[i].start + 1; @@ -2365,7 +2418,7 @@ static isl_stat add_var_sum_constraint(struct isl_sched_graph *graph, k = isl_basic_set_alloc_equality(graph->lp); if (k < 0) return isl_stat_error; - isl_seq_clr(graph->lp->eq[k], 1 + total); + isl_seq_clr(graph->lp->eq[k], 1 + total); isl_int_set_si(graph->lp->eq[k][1 + sum_pos], -1); for (i = 0; i < graph->n; ++i) { struct isl_sched_node *node = &graph->node[i]; @@ -3499,10 +3552,7 @@ static int add_intra_constraints(struct isl_sched_graph *graph, offset = coef_var_offset(coef); dim_map = intra_dim_map(ctx, graph, node, offset, 1); isl_dim_map_range(dim_map, 3 + pos, 0, 0, 0, 1, -1); - graph->lp = isl_basic_set_extend_constraints(graph->lp, - coef->n_eq, coef->n_ineq); - graph->lp = isl_basic_set_add_constraints_dim_map(graph->lp, - coef, dim_map); + graph->lp = add_constraints_dim_map(graph->lp, coef, dim_map); return 0; } @@ -3516,9 +3566,9 @@ static int add_intra_constraints(struct isl_sched_graph *graph, * (c_k_0 + c_k_n n + c_k_x y) - (c_j_0 + c_j_n n + c_j_x x) >= e_i * * for each (x,y) in R. - * We obtain general constraints on coefficients (c_0, c_n, c_x) + * We obtain general constraints on coefficients (c_0, c_n, c_x, c_y) * of valid constraints for R and then plug in - * (-e_i + c_k_0 - c_j_0, c_k_n - c_j_n, c_k_x - c_j_x) + * (-e_i + c_k_0 - c_j_0, c_k_n - c_j_n, -c_j_x, c_k_x) * with each coefficient (except e_i, c_*_0 and c_*_n) * represented as a pair of non-negative coefficients. */ @@ -3539,10 +3589,7 @@ static int add_inter_constraints(struct isl_sched_graph *graph, offset = coef_var_offset(coef); dim_map = inter_dim_map(ctx, graph, src, dst, offset, 1); isl_dim_map_range(dim_map, 3 + pos, 0, 0, 0, 1, -1); - graph->lp = isl_basic_set_extend_constraints(graph->lp, - coef->n_eq, coef->n_ineq); - graph->lp = isl_basic_set_add_constraints_dim_map(graph->lp, - coef, dim_map); + graph->lp = add_constraints_dim_map(graph->lp, coef, dim_map); return 0; } @@ -3557,7 +3604,7 @@ static isl_stat add_all_constraints(struct isl_sched_graph *graph) pos = 0; for (i = 0; i < graph->n_edge; ++i) { - struct isl_sched_edge *edge= &graph->edge[i]; + struct isl_sched_edge *edge = &graph->edge[i]; if (!is_any_validity(edge)) continue; @@ -3593,7 +3640,7 @@ static isl_stat count_all_constraints(struct isl_sched_graph *graph, *n_eq = *n_ineq = 0; for (i = 0; i < graph->n_edge; ++i) { - struct isl_sched_edge *edge= &graph->edge[i]; + struct isl_sched_edge *edge = &graph->edge[i]; if (!is_any_validity(edge)) continue; @@ -3697,7 +3744,7 @@ static isl_stat setup_carry_lp(isl_ctx *ctx, struct isl_sched_graph *graph, k = isl_basic_set_alloc_equality(graph->lp); if (k < 0) return isl_stat_error; - isl_seq_clr(graph->lp->eq[k], 1 + total); + isl_seq_clr(graph->lp->eq[k], 1 + total); isl_int_set_si(graph->lp->eq[k][0], -n_edge); isl_int_set_si(graph->lp->eq[k][1], 1); for (i = 0; i < n_edge; ++i) @@ -3712,7 +3759,7 @@ static isl_stat setup_carry_lp(isl_ctx *ctx, struct isl_sched_graph *graph, k = isl_basic_set_alloc_inequality(graph->lp); if (k < 0) return isl_stat_error; - isl_seq_clr(graph->lp->ineq[k], 1 + total); + isl_seq_clr(graph->lp->ineq[k], 1 + total); isl_int_set_si(graph->lp->ineq[k][4 + i], -1); isl_int_set_si(graph->lp->ineq[k][0], 1); } @@ -3849,7 +3896,7 @@ error: } /* Is the schedule row "sol" trivial on node "node"? - * That is, is the solution zero on the dimensions orthogonal to + * That is, is the solution zero on the dimensions linearly independent of * the previously found solutions? * Return 1 if the solution is trivial, 0 if it is not and -1 on error. * @@ -4050,7 +4097,8 @@ static int carries_dependences(__isl_keep isl_vec *sol, int n_edge) * Also, check that dependences are carried for at least one of * the "n_edge" edges. * - * If the computed schedule performs loop coalescing on a given node, + * If the schedule_treat_coalescing option is set and + * if the computed schedule performs loop coalescing on a given node, * i.e., if it is of the form * * c_i i + c_j j + ... @@ -4751,6 +4799,15 @@ static int bad_cluster(struct isl_sched_graph *graph) graph->n_total_row == graph->band_start; } +/* Is "edge" a proximity edge with a non-empty dependence relation? + */ +static isl_bool is_non_empty_proximity(struct isl_sched_edge *edge) +{ + if (!is_proximity(edge)) + return isl_bool_false; + return isl_bool_not(isl_map_plain_is_empty(edge->map)); +} + /* Return the index of an edge in "graph" that can be used to merge * two clusters in "c". * Return graph->n_edge if no such edge can be found. @@ -4774,8 +4831,12 @@ static int find_proximity(struct isl_sched_graph *graph, for (i = 0; i < graph->n_edge; ++i) { struct isl_sched_edge *edge = &graph->edge[i]; int dist, weight; + isl_bool prox; - if (!is_proximity(edge)) + prox = is_non_empty_proximity(edge); + if (prox < 0) + return -1; + if (!prox) continue; if (edge->no_merge) continue; @@ -6017,9 +6078,13 @@ static isl_stat compute_weights(struct isl_sched_graph *graph, struct isl_sched_node *src = edge->src; struct isl_sched_node *dst = edge->dst; isl_basic_map *hull; + isl_bool prox; int n_in, n_out; - if (!is_proximity(edge)) + prox = is_non_empty_proximity(edge); + if (prox < 0) + return isl_stat_error; + if (!prox) continue; if (bad_cluster(&c->scc[edge->src->scc]) || bad_cluster(&c->scc[edge->dst->scc])) @@ -6046,7 +6111,7 @@ static isl_stat compute_weights(struct isl_sched_graph *graph, isl_dim_out, 0, n_out); if (!hull) return isl_stat_error; - edge->weight = hull->n_eq; + edge->weight = isl_basic_map_n_equality(hull); isl_basic_map_free(hull); if (edge->weight > graph->max_weight) diff --git a/polly/lib/External/isl/isl_space.c b/polly/lib/External/isl/isl_space.c index 4af4f1a..0ddacc2 100644 --- a/polly/lib/External/isl/isl_space.c +++ b/polly/lib/External/isl/isl_space.c @@ -1931,10 +1931,9 @@ isl_bool isl_space_is_range(__isl_keep isl_space *space1, return isl_space_is_range_internal(space1, space2); } -/* Update "hash" by hashing in "space". - * Changes in this function should be reflected in isl_hash_space_domain. +/* Update "hash" by hashing in the parameters of "space". */ -static uint32_t isl_hash_space(uint32_t hash, __isl_keep isl_space *space) +static uint32_t isl_hash_params(uint32_t hash, __isl_keep isl_space *space) { int i; isl_id *id; @@ -1943,65 +1942,89 @@ static uint32_t isl_hash_space(uint32_t hash, __isl_keep isl_space *space) return hash; isl_hash_byte(hash, space->nparam % 256); - isl_hash_byte(hash, space->n_in % 256); - isl_hash_byte(hash, space->n_out % 256); for (i = 0; i < space->nparam; ++i) { id = get_id(space, isl_dim_param, i); hash = isl_hash_id(hash, id); } + return hash; +} + +/* Update "hash" by hashing in the tuples of "space". + * Changes in this function should be reflected in isl_hash_tuples_domain. + */ +static uint32_t isl_hash_tuples(uint32_t hash, __isl_keep isl_space *space) +{ + isl_id *id; + + if (!space) + return hash; + + isl_hash_byte(hash, space->n_in % 256); + isl_hash_byte(hash, space->n_out % 256); + id = tuple_id(space, isl_dim_in); hash = isl_hash_id(hash, id); id = tuple_id(space, isl_dim_out); hash = isl_hash_id(hash, id); - hash = isl_hash_space(hash, space->nested[0]); - hash = isl_hash_space(hash, space->nested[1]); + hash = isl_hash_tuples(hash, space->nested[0]); + hash = isl_hash_tuples(hash, space->nested[1]); return hash; } -/* Update "hash" by hashing in the domain of "space". +/* Update "hash" by hashing in the domain tuple of "space". * The result of this function is equal to the result of applying - * isl_hash_space to the domain of "space". + * isl_hash_tuples to the domain of "space". */ -static uint32_t isl_hash_space_domain(uint32_t hash, +static uint32_t isl_hash_tuples_domain(uint32_t hash, __isl_keep isl_space *space) { - int i; isl_id *id; if (!space) return hash; - isl_hash_byte(hash, space->nparam % 256); isl_hash_byte(hash, 0); isl_hash_byte(hash, space->n_in % 256); - for (i = 0; i < space->nparam; ++i) { - id = get_id(space, isl_dim_param, i); - hash = isl_hash_id(hash, id); - } - hash = isl_hash_id(hash, &isl_id_none); id = tuple_id(space, isl_dim_in); hash = isl_hash_id(hash, id); - hash = isl_hash_space(hash, space->nested[0]); + hash = isl_hash_tuples(hash, space->nested[0]); return hash; } -uint32_t isl_space_get_hash(__isl_keep isl_space *dim) +/* Return a hash value that digests the tuples of "space", + * i.e., that ignores the parameters. + */ +uint32_t isl_space_get_tuple_hash(__isl_keep isl_space *space) { uint32_t hash; - if (!dim) + if (!space) + return 0; + + hash = isl_hash_init(); + hash = isl_hash_tuples(hash, space); + + return hash; +} + +uint32_t isl_space_get_hash(__isl_keep isl_space *space) +{ + uint32_t hash; + + if (!space) return 0; hash = isl_hash_init(); - hash = isl_hash_space(hash, dim); + hash = isl_hash_params(hash, space); + hash = isl_hash_tuples(hash, space); return hash; } @@ -2018,7 +2041,8 @@ uint32_t isl_space_get_domain_hash(__isl_keep isl_space *space) return 0; hash = isl_hash_init(); - hash = isl_hash_space_domain(hash, space); + hash = isl_hash_params(hash, space); + hash = isl_hash_tuples_domain(hash, space); return hash; } @@ -2060,6 +2084,26 @@ isl_bool isl_space_range_is_wrapping(__isl_keep isl_space *space) return space->nested[1] != NULL; } +/* Is "space" a product of two spaces? + * That is, is it a wrapping set space or a map space + * with wrapping domain and range? + */ +isl_bool isl_space_is_product(__isl_keep isl_space *space) +{ + isl_bool is_set; + isl_bool is_product; + + is_set = isl_space_is_set(space); + if (is_set < 0) + return isl_bool_error; + if (is_set) + return isl_space_is_wrapping(space); + is_product = isl_space_domain_is_wrapping(space); + if (is_product < 0 || !is_product) + return is_product; + return isl_space_range_is_wrapping(space); +} + __isl_give isl_space *isl_space_wrap(__isl_take isl_space *dim) { isl_space *wrap; @@ -2244,12 +2288,16 @@ __isl_give isl_space *isl_space_lift(__isl_take isl_space *dim, unsigned n_local return dim; } -isl_bool isl_space_can_zip(__isl_keep isl_space *dim) +isl_bool isl_space_can_zip(__isl_keep isl_space *space) { - if (!dim) - return isl_bool_error; + isl_bool is_set; - return dim->nested[0] && dim->nested[1]; + is_set = isl_space_is_set(space); + if (is_set < 0) + return isl_bool_error; + if (is_set) + return isl_bool_false; + return isl_space_is_product(space); } __isl_give isl_space *isl_space_zip(__isl_take isl_space *dim) diff --git a/polly/lib/External/isl/isl_space_private.h b/polly/lib/External/isl/isl_space_private.h index 8f54653..783ba43 100644 --- a/polly/lib/External/isl/isl_space_private.h +++ b/polly/lib/External/isl/isl_space_private.h @@ -27,7 +27,8 @@ __isl_give isl_space *isl_space_cow(__isl_take isl_space *dim); __isl_give isl_space *isl_space_underlying(__isl_take isl_space *dim, unsigned n_div); -uint32_t isl_space_get_hash(__isl_keep isl_space *dim); +uint32_t isl_space_get_tuple_hash(__isl_keep isl_space *space); +uint32_t isl_space_get_hash(__isl_keep isl_space *space); uint32_t isl_space_get_domain_hash(__isl_keep isl_space *space); isl_bool isl_space_is_domain_internal(__isl_keep isl_space *space1, diff --git a/polly/lib/External/isl/isl_tab_pip.c b/polly/lib/External/isl/isl_tab_pip.c index 24ea34e..f342a16 100644 --- a/polly/lib/External/isl/isl_tab_pip.c +++ b/polly/lib/External/isl/isl_tab_pip.c @@ -5112,28 +5112,32 @@ static int is_optimal(__isl_keep isl_vec *sol, int n_op) * with all previous coefficients) to be zero. * If the solution is already optimal (all relevant coefficients are zero), * then just mark the table as empty. + * "n_zero" is the number of coefficients that have been forced zero + * by previous calls to this function at the same level. + * Return the updated number of forced zero coefficients or -1 on error. * - * This function assumes that at least 2 * n_op more rows and at least - * 2 * n_op more elements in the constraint array are available in the tableau. + * This function assumes that at least 2 * (n_op - n_zero) more rows and + * at least 2 * (n_op - n_zero) more elements in the constraint array + * are available in the tableau. */ static int force_better_solution(struct isl_tab *tab, - __isl_keep isl_vec *sol, int n_op) + __isl_keep isl_vec *sol, int n_op, int n_zero) { - int i; + int i, n; isl_ctx *ctx; isl_vec *v = NULL; if (!sol) return -1; - for (i = 0; i < n_op; ++i) + for (i = n_zero; i < n_op; ++i) if (!isl_int_is_zero(sol->el[1 + i])) break; if (i == n_op) { if (isl_tab_mark_empty(tab) < 0) return -1; - return 0; + return n_op; } ctx = isl_vec_get_ctx(sol); @@ -5141,7 +5145,8 @@ static int force_better_solution(struct isl_tab *tab, if (!v) return -1; - for (; i >= 0; --i) { + n = i + 1; + for (; i >= n_zero; --i) { v = isl_vec_clr(v); isl_int_set_si(v->el[1 + i], -1); if (add_lexmin_eq(tab, v->el) < 0) @@ -5149,14 +5154,21 @@ static int force_better_solution(struct isl_tab *tab, } isl_vec_free(v); - return 0; + return n; error: isl_vec_free(v); return -1; } +/* Local data at each level of the backtracking procedure of + * isl_tab_basic_set_non_trivial_lexmin. + * + * "n_zero" is the number of initial coordinates that have already + * been forced to be zero at this level. + */ struct isl_trivial { int update; + int n_zero; int region; int side; struct isl_tab_undo *snap; @@ -5169,7 +5181,7 @@ struct isl_trivial { * * n_op is the number of initial coordinates to optimize. * That is, once a solution has been found, we will only continue looking - * for solution that result in significantly better values for those + * for solutions that result in significantly better values for those * initial coordinates. That is, we only continue looking for solutions * that increase the number of initial zeros in this sequence. * @@ -5183,8 +5195,8 @@ struct isl_trivial { * reported to the caller through a call to "conflict". * * We perform a simple branch-and-bound backtracking search. - * Each level in the search represents initially trivial region that is forced - * to be non-trivial. + * Each level in the search represents an initially trivial region + * that is forced to be non-trivial. * At each level we consider n cases, where n is the length of the region. * In terms of the n/2 variables of unrestricted signs being encoded by * the region, we consider the cases @@ -5263,6 +5275,8 @@ __isl_give isl_vec *isl_tab_basic_set_non_trivial_lexmin( goto error; triv[level].region = r; triv[level].side = 0; + triv[level].update = 0; + triv[level].n_zero = 0; } r = triv[level].region; @@ -5280,7 +5294,9 @@ backtrack: } if (triv[level].update) { - if (force_better_solution(tab, sol, n_op) < 0) + 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; } diff --git a/polly/lib/External/isl/isl_union_map.c b/polly/lib/External/isl/isl_union_map.c index 96a1f88..5fc9ac5 100644 --- a/polly/lib/External/isl/isl_union_map.c +++ b/polly/lib/External/isl/isl_union_map.c @@ -2,7 +2,7 @@ * Copyright 2010-2011 INRIA Saclay * Copyright 2013-2014 Ecole Normale Superieure * Copyright 2014 INRIA Rocquencourt - * Copyright 2016 Sven Verdoolaege + * Copyright 2016-2017 Sven Verdoolaege * * Use of this software is governed by the MIT license * @@ -1520,41 +1520,122 @@ __isl_give isl_union_map *isl_union_map_flat_range_product( return bin_op(umap1, umap2, &flat_range_product_entry); } -static __isl_give isl_union_set *cond_un_op(__isl_take isl_union_map *umap, - isl_stat (*fn)(void **, void *)) +/* Data structure that specifies how un_op should modify + * the maps in the union map. + * + * If "inplace" is set, then the maps in the input union map + * are modified in place. This means that "fn_map" should not + * change the meaning of the map or that the union map only + * has a single reference. + * If "total" is set, then all maps need to be modified and + * 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 + * "total" is set. + * "fn_map" specifies how the maps (selected by "filter") + * should be transformed. + */ +struct isl_un_op_control { + int inplace; + int total; + isl_bool (*filter)(__isl_keep isl_map *map); + __isl_give isl_map *(*fn_map)(__isl_take isl_map *map); +}; + +/* Internal data structure for "un_op". + * "control" specifies how the maps in the union map should be modified. + * "res" collects the results. + */ +struct isl_union_map_un_data { + struct isl_un_op_control *control; + isl_union_map *res; +}; + +/* isl_hash_table_foreach callback for un_op. + * Handle the map that "entry" points to. + * + * If control->filter is set, then check if this map satisfies the filter. + * If so (or if control->filter is not set), modify the map + * by calling control->fn_map and either add the result to data->res or + * replace the original entry by the result (if control->inplace is set). + */ +static isl_stat un_entry(void **entry, void *user) { - isl_union_set *res; + struct isl_union_map_un_data *data = user; + isl_map *map = *entry; - if (!umap) - return NULL; + if (data->control->filter) { + isl_bool ok; - res = isl_union_map_alloc(isl_space_copy(umap->dim), umap->table.n); - if (isl_hash_table_foreach(umap->dim->ctx, &umap->table, fn, &res) < 0) - goto error; + ok = data->control->filter(map); + if (ok < 0) + return isl_stat_error; + if (!ok) + return isl_stat_ok; + } - isl_union_map_free(umap); - return res; -error: - isl_union_map_free(umap); - isl_union_set_free(res); - return NULL; + map = data->control->fn_map(isl_map_copy(map)); + if (!map) + return isl_stat_error; + if (data->control->inplace) { + isl_map_free(*entry); + *entry = map; + } else { + data->res = isl_union_map_add_map(data->res, map); + if (!data->res) + return isl_stat_error; + } + + return isl_stat_ok; } -static isl_stat from_range_entry(void **entry, void *user) +/* Modify the maps in "umap" based on "control". + * If control->inplace is set, then modify the maps in "umap" in-place. + * Otherwise, create a new union map to hold the results. + * If control->total is set, then perform an inplace computation + * if "umap" is only referenced once. Otherwise, create a new union map + * to store the results. + */ +static __isl_give isl_union_map *un_op(__isl_take isl_union_map *umap, + struct isl_un_op_control *control) { - isl_map *set = *entry; - isl_union_set **res = user; + struct isl_union_map_un_data data = { control }; - *res = isl_union_map_add_map(*res, - isl_map_from_range(isl_set_copy(set))); + if (!umap) + return NULL; + if ((control->inplace || control->total) && control->filter) + isl_die(isl_union_map_get_ctx(umap), isl_error_invalid, + "inplace/total modification cannot be filtered", + return isl_union_map_free(umap)); - return isl_stat_ok; + if (control->total && umap->ref == 1) + control->inplace = 1; + if (control->inplace) { + data.res = umap; + } else { + isl_space *space; + + space = isl_union_map_get_space(umap); + data.res = isl_union_map_alloc(space, umap->table.n); + } + if (isl_hash_table_foreach(isl_union_map_get_ctx(umap), + &umap->table, &un_entry, &data) < 0) + data.res = isl_union_map_free(data.res); + + if (control->inplace) + return data.res; + isl_union_map_free(umap); + return data.res; } __isl_give isl_union_map *isl_union_map_from_range( __isl_take isl_union_set *uset) { - return cond_un_op(uset, &from_range_entry); + struct isl_un_op_control control = { + .fn_map = &isl_map_from_range, + }; + return un_op(uset, &control); } __isl_give isl_union_map *isl_union_map_from_domain( @@ -1570,35 +1651,31 @@ __isl_give isl_union_map *isl_union_map_from_domain_and_range( isl_union_map_from_range(range)); } -static __isl_give isl_union_map *un_op(__isl_take isl_union_map *umap, - isl_stat (*fn)(void **, void *)) +/* Modify the maps in "umap" by applying "fn" on them. + * "fn" should apply to all maps in "umap" and should not modify the space. + */ +static __isl_give isl_union_map *total(__isl_take isl_union_map *umap, + __isl_give isl_map *(*fn)(__isl_take isl_map *)) { - umap = isl_union_map_cow(umap); - if (!umap) - return NULL; - - if (isl_hash_table_foreach(umap->dim->ctx, &umap->table, fn, NULL) < 0) - goto error; + struct isl_un_op_control control = { + .total = 1, + .fn_map = fn, + }; - return umap; -error: - isl_union_map_free(umap); - return NULL; + return un_op(umap, &control); } -static isl_stat affine_entry(void **entry, void *user) +/* Compute the affine hull of "map" and return the result as an isl_map. + */ +static __isl_give isl_map *isl_map_affine_hull_map(__isl_take isl_map *map) { - isl_map **map = (isl_map **)entry; - - *map = isl_map_from_basic_map(isl_map_affine_hull(*map)); - - return *map ? isl_stat_ok : isl_stat_error; + return isl_map_from_basic_map(isl_map_affine_hull(map)); } __isl_give isl_union_map *isl_union_map_affine_hull( __isl_take isl_union_map *umap) { - return un_op(umap, &affine_entry); + return total(umap, &isl_map_affine_hull_map); } __isl_give isl_union_set *isl_union_set_affine_hull( @@ -1607,19 +1684,17 @@ __isl_give isl_union_set *isl_union_set_affine_hull( return isl_union_map_affine_hull(uset); } -static isl_stat polyhedral_entry(void **entry, void *user) +/* Compute the polyhedral hull of "map" and return the result as an isl_map. + */ +static __isl_give isl_map *isl_map_polyhedral_hull_map(__isl_take isl_map *map) { - isl_map **map = (isl_map **)entry; - - *map = isl_map_from_basic_map(isl_map_polyhedral_hull(*map)); - - return *map ? isl_stat_ok : isl_stat_error; + return isl_map_from_basic_map(isl_map_polyhedral_hull(map)); } __isl_give isl_union_map *isl_union_map_polyhedral_hull( __isl_take isl_union_map *umap) { - return un_op(umap, &polyhedral_entry); + return total(umap, &isl_map_polyhedral_hull_map); } __isl_give isl_union_set *isl_union_set_polyhedral_hull( @@ -1628,19 +1703,19 @@ __isl_give isl_union_set *isl_union_set_polyhedral_hull( return isl_union_map_polyhedral_hull(uset); } -static isl_stat simple_entry(void **entry, void *user) +/* Compute a superset of the convex hull of "map" that is described + * by only translates of the constraints in the constituents of "map" and + * return the result as an isl_map. + */ +static __isl_give isl_map *isl_map_simple_hull_map(__isl_take isl_map *map) { - isl_map **map = (isl_map **)entry; - - *map = isl_map_from_basic_map(isl_map_simple_hull(*map)); - - return *map ? isl_stat_ok : isl_stat_error; + return isl_map_from_basic_map(isl_map_simple_hull(map)); } __isl_give isl_union_map *isl_union_map_simple_hull( __isl_take isl_union_map *umap) { - return un_op(umap, &simple_entry); + return total(umap, &isl_map_simple_hull_map); } __isl_give isl_union_set *isl_union_set_simple_hull( @@ -1649,37 +1724,15 @@ __isl_give isl_union_set *isl_union_set_simple_hull( return isl_union_map_simple_hull(uset); } -static isl_stat inplace_entry(void **entry, void *user) -{ - __isl_give isl_map *(*fn)(__isl_take isl_map *); - isl_map **map = (isl_map **)entry; - isl_map *copy; - - fn = *(__isl_give isl_map *(**)(__isl_take isl_map *)) user; - copy = fn(isl_map_copy(*map)); - if (!copy) - return isl_stat_error; - - isl_map_free(*map); - *map = copy; - - return isl_stat_ok; -} - static __isl_give isl_union_map *inplace(__isl_take isl_union_map *umap, __isl_give isl_map *(*fn)(__isl_take isl_map *)) { - if (!umap) - return NULL; - - if (isl_hash_table_foreach(umap->dim->ctx, &umap->table, - &inplace_entry, &fn) < 0) - goto error; + struct isl_un_op_control control = { + .inplace = 1, + .fn_map = fn, + }; - return umap; -error: - isl_union_map_free(umap); - return NULL; + return un_op(umap, &control); } /* Remove redundant constraints in each of the basic maps of "umap". @@ -1736,19 +1789,10 @@ __isl_give isl_union_set *isl_union_set_compute_divs( return isl_union_map_compute_divs(uset); } -static isl_stat lexmin_entry(void **entry, void *user) -{ - isl_map **map = (isl_map **)entry; - - *map = isl_map_lexmin(*map); - - return *map ? isl_stat_ok : isl_stat_error; -} - __isl_give isl_union_map *isl_union_map_lexmin( __isl_take isl_union_map *umap) { - return un_op(umap, &lexmin_entry); + return total(umap, &isl_map_lexmin); } __isl_give isl_union_set *isl_union_set_lexmin( @@ -1757,19 +1801,10 @@ __isl_give isl_union_set *isl_union_set_lexmin( return isl_union_map_lexmin(uset); } -static isl_stat lexmax_entry(void **entry, void *user) -{ - isl_map **map = (isl_map **)entry; - - *map = isl_map_lexmax(*map); - - return *map ? isl_stat_ok : isl_stat_error; -} - __isl_give isl_union_map *isl_union_map_lexmax( __isl_take isl_union_map *umap) { - return un_op(umap, &lexmax_entry); + return total(umap, &isl_map_lexmax); } __isl_give isl_union_set *isl_union_set_lexmax( @@ -1778,20 +1813,23 @@ __isl_give isl_union_set *isl_union_set_lexmax( return isl_union_map_lexmax(uset); } -static isl_stat universe_entry(void **entry, void *user) +/* Return the universe in the space of "map". + */ +static __isl_give isl_map *universe(__isl_take isl_map *map) { - isl_map *map = *entry; - isl_union_map **res = user; - - map = isl_map_universe(isl_map_get_space(map)); - *res = isl_union_map_add_map(*res, map); + isl_space *space; - return isl_stat_ok; + space = isl_map_get_space(map); + isl_map_free(map); + return isl_map_universe(space); } __isl_give isl_union_map *isl_union_map_universe(__isl_take isl_union_map *umap) { - return cond_un_op(umap, &universe_entry); + struct isl_un_op_control control = { + .fn_map = &universe, + }; + return un_op(umap, &control); } __isl_give isl_union_set *isl_union_set_universe(__isl_take isl_union_set *uset) @@ -1799,35 +1837,21 @@ __isl_give isl_union_set *isl_union_set_universe(__isl_take isl_union_set *uset) return isl_union_map_universe(uset); } -static isl_stat reverse_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_map **res = user; - - *res = isl_union_map_add_map(*res, isl_map_reverse(isl_map_copy(map))); - - return isl_stat_ok; -} - __isl_give isl_union_map *isl_union_map_reverse(__isl_take isl_union_map *umap) { - return cond_un_op(umap, &reverse_entry); -} - -static isl_stat params_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_set **res = user; - - *res = isl_union_set_add_set(*res, isl_map_params(isl_map_copy(map))); - - return isl_stat_ok; + struct isl_un_op_control control = { + .fn_map = &isl_map_reverse, + }; + return un_op(umap, &control); } /* Compute the parameter domain of the given union map. */ __isl_give isl_set *isl_union_map_params(__isl_take isl_union_map *umap) { + struct isl_un_op_control control = { + .fn_map = &isl_map_params, + }; int empty; empty = isl_union_map_is_empty(umap); @@ -1839,7 +1863,7 @@ __isl_give isl_set *isl_union_map_params(__isl_take isl_union_map *umap) isl_union_map_free(umap); return isl_set_empty(space); } - return isl_set_from_union_set(cond_un_op(umap, ¶ms_entry)); + return isl_set_from_union_set(un_op(umap, &control)); error: isl_union_map_free(umap); return NULL; @@ -1852,51 +1876,29 @@ __isl_give isl_set *isl_union_set_params(__isl_take isl_union_set *uset) return isl_union_map_params(uset); } -static isl_stat domain_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_set **res = user; - - *res = isl_union_set_add_set(*res, isl_map_domain(isl_map_copy(map))); - - return isl_stat_ok; -} - __isl_give isl_union_set *isl_union_map_domain(__isl_take isl_union_map *umap) { - return cond_un_op(umap, &domain_entry); -} - -static isl_stat range_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_set **res = user; - - *res = isl_union_set_add_set(*res, isl_map_range(isl_map_copy(map))); - - return isl_stat_ok; + struct isl_un_op_control control = { + .fn_map = &isl_map_domain, + }; + return un_op(umap, &control); } __isl_give isl_union_set *isl_union_map_range(__isl_take isl_union_map *umap) { - return cond_un_op(umap, &range_entry); -} - -static isl_stat domain_map_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_set **res = user; - - *res = isl_union_map_add_map(*res, - isl_map_domain_map(isl_map_copy(map))); - - return isl_stat_ok; + struct isl_un_op_control control = { + .fn_map = &isl_map_range, + }; + return un_op(umap, &control); } __isl_give isl_union_map *isl_union_map_domain_map( __isl_take isl_union_map *umap) { - return cond_un_op(umap, &domain_map_entry); + struct isl_un_op_control control = { + .fn_map = &isl_map_domain_map, + }; + return un_op(umap, &control); } /* Construct an isl_pw_multi_aff that maps "map" to its domain and @@ -1932,42 +1934,13 @@ __isl_give isl_union_pw_multi_aff *isl_union_map_domain_map_union_pw_multi_aff( return res; } -static isl_stat range_map_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_set **res = user; - - *res = isl_union_map_add_map(*res, - isl_map_range_map(isl_map_copy(map))); - - return isl_stat_ok; -} - __isl_give isl_union_map *isl_union_map_range_map( __isl_take isl_union_map *umap) { - return cond_un_op(umap, &range_map_entry); -} - -/* Check if "set" is of the form A[B -> C]. - * If so, add A[B -> C] -> B to "res". - */ -static isl_stat wrapped_domain_map_entry(void **entry, void *user) -{ - isl_set *set = *entry; - isl_union_set **res = user; - int wrapping; - - wrapping = isl_set_is_wrapping(set); - if (wrapping < 0) - return isl_stat_error; - if (!wrapping) - return isl_stat_ok; - - *res = isl_union_map_add_map(*res, - isl_set_wrapped_domain_map(isl_set_copy(set))); - - return isl_stat_ok; + struct isl_un_op_control control = { + .fn_map = &isl_map_range_map, + }; + return un_op(umap, &control); } /* Given a collection of wrapped maps of the form A[B -> C], @@ -1976,62 +1949,46 @@ static isl_stat wrapped_domain_map_entry(void **entry, void *user) __isl_give isl_union_map *isl_union_set_wrapped_domain_map( __isl_take isl_union_set *uset) { - return cond_un_op(uset, &wrapped_domain_map_entry); + struct isl_un_op_control control = { + .filter = &isl_set_is_wrapping, + .fn_map = &isl_set_wrapped_domain_map, + }; + return un_op(uset, &control); } -static isl_stat deltas_entry(void **entry, void *user) +/* Does "map" relate elements from the same space? + */ +static isl_bool equal_tuples(__isl_keep isl_map *map) { - isl_map *map = *entry; - isl_union_set **res = user; - - if (!isl_space_tuple_is_equal(map->dim, isl_dim_in, - map->dim, isl_dim_out)) - return isl_stat_ok; - - *res = isl_union_set_add_set(*res, isl_map_deltas(isl_map_copy(map))); - - return isl_stat_ok; + return isl_space_tuple_is_equal(map->dim, isl_dim_in, + map->dim, isl_dim_out); } __isl_give isl_union_set *isl_union_map_deltas(__isl_take isl_union_map *umap) { - return cond_un_op(umap, &deltas_entry); -} - -static isl_stat deltas_map_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_map **res = user; - - if (!isl_space_tuple_is_equal(map->dim, isl_dim_in, - map->dim, isl_dim_out)) - return isl_stat_ok; - - *res = isl_union_map_add_map(*res, - isl_map_deltas_map(isl_map_copy(map))); - - return isl_stat_ok; + struct isl_un_op_control control = { + .filter = &equal_tuples, + .fn_map = &isl_map_deltas, + }; + return un_op(umap, &control); } __isl_give isl_union_map *isl_union_map_deltas_map( __isl_take isl_union_map *umap) { - return cond_un_op(umap, &deltas_map_entry); -} - -static isl_stat identity_entry(void **entry, void *user) -{ - isl_set *set = *entry; - isl_union_map **res = user; - - *res = isl_union_map_add_map(*res, isl_set_identity(isl_set_copy(set))); - - return isl_stat_ok; + struct isl_un_op_control control = { + .filter = &equal_tuples, + .fn_map = &isl_map_deltas_map, + }; + return un_op(umap, &control); } __isl_give isl_union_map *isl_union_set_identity(__isl_take isl_union_set *uset) { - return cond_un_op(uset, &identity_entry); + struct isl_un_op_control control = { + .fn_map = &isl_set_identity, + }; + return un_op(uset, &control); } /* Construct an identity isl_pw_multi_aff on "set" and add it to *res. @@ -2066,45 +2023,17 @@ __isl_give isl_union_pw_multi_aff *isl_union_set_identity_union_pw_multi_aff( return res; } -/* If "map" is of the form [A -> B] -> C, then add A -> C to "res". - */ -static isl_stat domain_factor_domain_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_map **res = user; - - if (!isl_map_domain_is_wrapping(map)) - return isl_stat_ok; - - *res = isl_union_map_add_map(*res, - isl_map_domain_factor_domain(isl_map_copy(map))); - - return *res ? isl_stat_ok : isl_stat_error; -} - /* For each map in "umap" of the form [A -> B] -> C, * construct the map A -> C and collect the results. */ __isl_give isl_union_map *isl_union_map_domain_factor_domain( __isl_take isl_union_map *umap) { - return cond_un_op(umap, &domain_factor_domain_entry); -} - -/* If "map" is of the form [A -> B] -> C, then add B -> C to "res". - */ -static isl_stat domain_factor_range_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_map **res = user; - - if (!isl_map_domain_is_wrapping(map)) - return isl_stat_ok; - - *res = isl_union_map_add_map(*res, - isl_map_domain_factor_range(isl_map_copy(map))); - - return *res ? isl_stat_ok : isl_stat_error; + struct isl_un_op_control control = { + .filter = &isl_map_domain_is_wrapping, + .fn_map = &isl_map_domain_factor_domain, + }; + return un_op(umap, &control); } /* For each map in "umap" of the form [A -> B] -> C, @@ -2113,23 +2042,11 @@ static isl_stat domain_factor_range_entry(void **entry, void *user) __isl_give isl_union_map *isl_union_map_domain_factor_range( __isl_take isl_union_map *umap) { - return cond_un_op(umap, &domain_factor_range_entry); -} - -/* If "map" is of the form A -> [B -> C], then add A -> B to "res". - */ -static isl_stat range_factor_domain_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_map **res = user; - - if (!isl_map_range_is_wrapping(map)) - return isl_stat_ok; - - *res = isl_union_map_add_map(*res, - isl_map_range_factor_domain(isl_map_copy(map))); - - return *res ? isl_stat_ok : isl_stat_error; + struct isl_un_op_control control = { + .filter = &isl_map_domain_is_wrapping, + .fn_map = &isl_map_domain_factor_range, + }; + return un_op(umap, &control); } /* For each map in "umap" of the form A -> [B -> C], @@ -2138,23 +2055,11 @@ static isl_stat range_factor_domain_entry(void **entry, void *user) __isl_give isl_union_map *isl_union_map_range_factor_domain( __isl_take isl_union_map *umap) { - return cond_un_op(umap, &range_factor_domain_entry); -} - -/* If "map" is of the form A -> [B -> C], then add A -> C to "res". - */ -static isl_stat range_factor_range_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_map **res = user; - - if (!isl_map_range_is_wrapping(map)) - return isl_stat_ok; - - *res = isl_union_map_add_map(*res, - isl_map_range_factor_range(isl_map_copy(map))); - - return *res ? isl_stat_ok : isl_stat_error; + struct isl_un_op_control control = { + .filter = &isl_map_range_is_wrapping, + .fn_map = &isl_map_range_factor_domain, + }; + return un_op(umap, &control); } /* For each map in "umap" of the form A -> [B -> C], @@ -2163,23 +2068,11 @@ static isl_stat range_factor_range_entry(void **entry, void *user) __isl_give isl_union_map *isl_union_map_range_factor_range( __isl_take isl_union_map *umap) { - return cond_un_op(umap, &range_factor_range_entry); -} - -/* If "map" is of the form [A -> B] -> [C -> D], then add A -> C to "res". - */ -static isl_stat factor_domain_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_map **res = user; - - if (!isl_map_domain_is_wrapping(map) || !isl_map_range_is_wrapping(map)) - return isl_stat_ok; - - *res = isl_union_map_add_map(*res, - isl_map_factor_domain(isl_map_copy(map))); - - return *res ? isl_stat_ok : isl_stat_error; + struct isl_un_op_control control = { + .filter = &isl_map_range_is_wrapping, + .fn_map = &isl_map_range_factor_range, + }; + return un_op(umap, &control); } /* For each map in "umap" of the form [A -> B] -> [C -> D], @@ -2188,23 +2081,11 @@ static isl_stat factor_domain_entry(void **entry, void *user) __isl_give isl_union_map *isl_union_map_factor_domain( __isl_take isl_union_map *umap) { - return cond_un_op(umap, &factor_domain_entry); -} - -/* If "map" is of the form [A -> B] -> [C -> D], then add B -> D to "res". - */ -static isl_stat factor_range_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_map **res = user; - - if (!isl_map_domain_is_wrapping(map) || !isl_map_range_is_wrapping(map)) - return isl_stat_ok; - - *res = isl_union_map_add_map(*res, - isl_map_factor_range(isl_map_copy(map))); - - return *res ? isl_stat_ok : isl_stat_error; + struct isl_un_op_control control = { + .filter = &isl_map_is_product, + .fn_map = &isl_map_factor_domain, + }; + return un_op(umap, &control); } /* For each map in "umap" of the form [A -> B] -> [C -> D], @@ -2213,40 +2094,28 @@ static isl_stat factor_range_entry(void **entry, void *user) __isl_give isl_union_map *isl_union_map_factor_range( __isl_take isl_union_map *umap) { - return cond_un_op(umap, &factor_range_entry); -} - -static isl_stat unwrap_entry(void **entry, void *user) -{ - isl_set *set = *entry; - isl_union_set **res = user; - - if (!isl_set_is_wrapping(set)) - return isl_stat_ok; - - *res = isl_union_map_add_map(*res, isl_set_unwrap(isl_set_copy(set))); - - return isl_stat_ok; + struct isl_un_op_control control = { + .filter = &isl_map_is_product, + .fn_map = &isl_map_factor_range, + }; + return un_op(umap, &control); } __isl_give isl_union_map *isl_union_set_unwrap(__isl_take isl_union_set *uset) { - return cond_un_op(uset, &unwrap_entry); -} - -static isl_stat wrap_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_set **res = user; - - *res = isl_union_set_add_set(*res, isl_map_wrap(isl_map_copy(map))); - - return isl_stat_ok; + struct isl_un_op_control control = { + .filter = &isl_set_is_wrapping, + .fn_map = &isl_set_unwrap, + }; + return un_op(uset, &control); } __isl_give isl_union_set *isl_union_map_wrap(__isl_take isl_union_map *umap) { - return cond_un_op(umap, &wrap_entry); + struct isl_un_op_control control = { + .fn_map = &isl_map_wrap, + }; + return un_op(umap, &control); } struct isl_union_map_is_subset_data { @@ -3027,35 +2896,13 @@ isl_bool isl_union_map_is_bijective(__isl_keep isl_union_map *umap) return isl_union_map_is_injective(umap); } -static isl_stat zip_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_map **res = user; - - if (!isl_map_can_zip(map)) - return isl_stat_ok; - - *res = isl_union_map_add_map(*res, isl_map_zip(isl_map_copy(map))); - - return isl_stat_ok; -} - __isl_give isl_union_map *isl_union_map_zip(__isl_take isl_union_map *umap) { - return cond_un_op(umap, &zip_entry); -} - -static isl_stat uncurry_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_map **res = user; - - if (!isl_map_can_uncurry(map)) - return isl_stat_ok; - - *res = isl_union_map_add_map(*res, isl_map_uncurry(isl_map_copy(map))); - - return isl_stat_ok; + struct isl_un_op_control control = { + .filter = &isl_map_can_zip, + .fn_map = &isl_map_zip, + }; + return un_op(umap, &control); } /* Given a union map, take the maps of the form A -> (B -> C) and @@ -3063,20 +2910,11 @@ static isl_stat uncurry_entry(void **entry, void *user) */ __isl_give isl_union_map *isl_union_map_uncurry(__isl_take isl_union_map *umap) { - return cond_un_op(umap, &uncurry_entry); -} - -static isl_stat curry_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_map **res = user; - - if (!isl_map_can_curry(map)) - return isl_stat_ok; - - *res = isl_union_map_add_map(*res, isl_map_curry(isl_map_copy(map))); - - return isl_stat_ok; + struct isl_un_op_control control = { + .filter = &isl_map_can_uncurry, + .fn_map = &isl_map_uncurry, + }; + return un_op(umap, &control); } /* Given a union map, take the maps of the form (A -> B) -> C and @@ -3084,24 +2922,11 @@ static isl_stat curry_entry(void **entry, void *user) */ __isl_give isl_union_map *isl_union_map_curry(__isl_take isl_union_map *umap) { - return cond_un_op(umap, &curry_entry); -} - -/* If *entry is of the form A -> ((B -> C) -> D), then apply - * isl_map_range_curry to it and add the result to *res. - */ -static isl_stat range_curry_entry(void **entry, void *user) -{ - isl_map *map = *entry; - isl_union_map **res = user; - - if (!isl_map_can_range_curry(map)) - return isl_stat_ok; - - map = isl_map_range_curry(isl_map_copy(map)); - *res = isl_union_map_add_map(*res, map); - - return isl_stat_ok; + struct isl_un_op_control control = { + .filter = &isl_map_can_curry, + .fn_map = &isl_map_curry, + }; + return un_op(umap, &control); } /* Given a union map, take the maps of the form A -> ((B -> C) -> D) and @@ -3110,22 +2935,19 @@ static isl_stat range_curry_entry(void **entry, void *user) __isl_give isl_union_map *isl_union_map_range_curry( __isl_take isl_union_map *umap) { - return cond_un_op(umap, &range_curry_entry); -} - -static isl_stat lift_entry(void **entry, void *user) -{ - isl_set *set = *entry; - isl_union_set **res = user; - - *res = isl_union_set_add_set(*res, isl_set_lift(isl_set_copy(set))); - - return isl_stat_ok; + struct isl_un_op_control control = { + .filter = &isl_map_can_range_curry, + .fn_map = &isl_map_range_curry, + }; + return un_op(umap, &control); } __isl_give isl_union_set *isl_union_set_lift(__isl_take isl_union_set *uset) { - return cond_un_op(uset, &lift_entry); + struct isl_un_op_control control = { + .fn_map = &isl_set_lift, + }; + return un_op(uset, &control); } static isl_stat coefficients_entry(void **entry, void *user) @@ -3618,18 +3440,6 @@ __isl_give isl_union_set *isl_union_set_preimage_union_pw_multi_aff( } /* Reset the user pointer on all identifiers of parameters and tuples - * of the space of *entry. - */ -static isl_stat reset_user(void **entry, void *user) -{ - isl_map **map = (isl_map **)entry; - - *map = isl_map_reset_user(*map); - - return *map ? isl_stat_ok : isl_stat_error; -} - -/* Reset the user pointer on all identifiers of parameters and tuples * of the spaces of "umap". */ __isl_give isl_union_map *isl_union_map_reset_user( @@ -3641,9 +3451,7 @@ __isl_give isl_union_map *isl_union_map_reset_user( umap->dim = isl_space_reset_user(umap->dim); if (!umap->dim) return isl_union_map_free(umap); - umap = un_op(umap, &reset_user); - - return umap; + return total(umap, &isl_map_reset_user); } /* Reset the user pointer on all identifiers of parameters and tuples diff --git a/polly/lib/External/isl/isl_val.c b/polly/lib/External/isl/isl_val.c index b1c6f79..4022f31 100644 --- a/polly/lib/External/isl/isl_val.c +++ b/polly/lib/External/isl/isl_val.c @@ -1170,6 +1170,9 @@ isl_bool isl_val_is_one(__isl_keep isl_val *v) if (!v) return isl_bool_error; + if (isl_val_is_nan(v)) + return isl_bool_false; + return isl_int_eq(v->n, v->d); } diff --git a/polly/lib/External/isl/m4/ax_cxx_compile_stdcxx.m4 b/polly/lib/External/isl/m4/ax_cxx_compile_stdcxx.m4 new file mode 100644 index 0000000..5032bba --- /dev/null +++ b/polly/lib/External/isl/m4/ax_cxx_compile_stdcxx.m4 @@ -0,0 +1,982 @@ +# =========================================================================== +# 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 new file mode 100644 index 0000000..0aadeaf --- /dev/null +++ b/polly/lib/External/isl/m4/ax_cxx_compile_stdcxx_11.m4 @@ -0,0 +1,39 @@ +# ============================================================================ +# 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/m4/ax_detect_clang.m4 b/polly/lib/External/isl/m4/ax_detect_clang.m4 index d511dab..2e2d2d6 100644 --- a/polly/lib/External/isl/m4/ax_detect_clang.m4 +++ b/polly/lib/External/isl/m4/ax_detect_clang.m4 @@ -16,7 +16,7 @@ if test "$llvm_config_found" != yes; then AC_MSG_ERROR([llvm-config not found]) fi CLANG_CXXFLAGS=`$llvm_config --cxxflags | \ - $SED -e 's/-Wcovered-switch-default//'` + $SED -e 's/-Wcovered-switch-default//;s/-gsplit-dwarf//'` CLANG_LDFLAGS=`$llvm_config --ldflags` targets=`$llvm_config --targets-built` components="$targets asmparser bitreader support mc" diff --git a/polly/lib/External/isl/test_inputs/codegen/atomic.c b/polly/lib/External/isl/test_inputs/codegen/atomic.c index 73731c0..0b70279 100644 --- a/polly/lib/External/isl/test_inputs/codegen/atomic.c +++ b/polly/lib/External/isl/test_inputs/codegen/atomic.c @@ -1,6 +1,6 @@ for (int c0 = 0; c0 <= 10; c0 += 1) { - if (c0 >= 1) - b(c0 - 1); if (c0 <= 9) a(c0); + if (c0 >= 1) + b(c0 - 1); } diff --git a/polly/lib/External/isl/test_inputs/codegen/atomic.in b/polly/lib/External/isl/test_inputs/codegen/atomic.in index 754b3d0..6d8f818 100644 --- a/polly/lib/External/isl/test_inputs/codegen/atomic.in +++ b/polly/lib/External/isl/test_inputs/codegen/atomic.in @@ -1,3 +1,3 @@ -{ a[i] -> [i] : 0 <= i < 10; b[i] -> [i+1] : 0 <= i < 10 } +{ a[i] -> [i, 0] : 0 <= i < 10; b[i] -> [i+1, 1] : 0 <= i < 10 } { : } -{ [i] -> atomic[x] } +{ [i, d] -> atomic[x] } diff --git a/polly/lib/External/isl/test_inputs/codegen/atomic.st b/polly/lib/External/isl/test_inputs/codegen/atomic.st index ca46e0e..7591b05 100644 --- a/polly/lib/External/isl/test_inputs/codegen/atomic.st +++ b/polly/lib/External/isl/test_inputs/codegen/atomic.st @@ -2,3 +2,7 @@ domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }" child: schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]" options: "{ atomic[x] }" + child: + sequence: + - filter: "{ a[i] }" + - filter: "{ b[i] }" diff --git a/polly/lib/External/isl/test_inputs/codegen/cholesky.c b/polly/lib/External/isl/test_inputs/codegen/cholesky.c new file mode 100644 index 0000000..7e6f215 --- /dev/null +++ b/polly/lib/External/isl/test_inputs/codegen/cholesky.c @@ -0,0 +1,4 @@ +for (int c0 = 3993; c0 <= 63893; c0 += 1) + if (2 * c0 - 3993 * ((3 * c0 + 5990) / 5990) >= 0) + for (int c4 = -c0 + 1997 * ((3 * c0 + 5990) / 5990) + 1; c4 <= 12; c4 += 1) + S_3(c4, -c0 + 1997 * ((3 * c0 + 5990) / 5990), 2 * c0 - 3993 * ((3 * c0 + 5990) / 5990)); diff --git a/polly/lib/External/isl/test_inputs/codegen/cholesky.st b/polly/lib/External/isl/test_inputs/codegen/cholesky.st new file mode 100644 index 0000000..2dd62b9 --- /dev/null +++ b/polly/lib/External/isl/test_inputs/codegen/cholesky.st @@ -0,0 +1,9 @@ +# Earlier versions of isl would fail to produce an AST for this input +# due to a simplification bug. +domain: "{ S_3[i, j, k] : 0 <= i <= 12 and 0 <= j < i and 0 <= k < j }" +child: + schedule: "[{ S_3[i, j, k] -> [(3993j + 1997k)] }]" + child: + schedule: "[{ S_3[i, j, k] -> [(32*floor((2j + k)/32))] }, { S_3[i, j, k] -> [(32*floor((i)/32))] }]" + child: + schedule: "[{ S_3[i, j, k] -> [(2j + k - 32*floor((2j + k)/32))] }, { S_3[i, j, k] -> [(i)] }]" diff --git a/polly/lib/External/isl/test_inputs/codegen/cloog/4-param.c b/polly/lib/External/isl/test_inputs/codegen/cloog/4-param.c index 56659a0..bd38c70 100644 --- a/polly/lib/External/isl/test_inputs/codegen/cloog/4-param.c +++ b/polly/lib/External/isl/test_inputs/codegen/cloog/4-param.c @@ -1,14 +1,14 @@ { - for (int c0 = m; c0 <= min(n, p - 1); c0 += 1) - S1(c0); for (int c0 = p; c0 <= min(m - 1, q); c0 += 1) S2(c0); + for (int c0 = m; c0 <= min(n, p - 1); c0 += 1) + S1(c0); for (int c0 = max(m, p); c0 <= min(n, q); c0 += 1) { S1(c0); S2(c0); } - for (int c0 = max(max(m, p), q + 1); c0 <= n; c0 += 1) - S1(c0); for (int c0 = max(max(m, n + 1), p); c0 <= q; c0 += 1) S2(c0); + for (int c0 = max(max(m, p), q + 1); c0 <= n; c0 += 1) + S1(c0); } diff --git a/polly/lib/External/isl/test_inputs/codegen/cloog/byu98-1-2-3.c b/polly/lib/External/isl/test_inputs/codegen/cloog/byu98-1-2-3.c index 8e87cba..fad89a9 100644 --- a/polly/lib/External/isl/test_inputs/codegen/cloog/byu98-1-2-3.c +++ b/polly/lib/External/isl/test_inputs/codegen/cloog/byu98-1-2-3.c @@ -3,13 +3,13 @@ for (int c1 = -c0 + 6; c1 <= 6; c1 += 1) S1(c0, c1); for (int c0 = 4; c0 <= 8; c0 += 1) { - if (c0 >= 6) { + if (c0 == 4) + for (int c1 = 3; c1 <= 4; c1 += 1) + S1(4, c1); + if (c0 <= 5) { + S1(c0, -c0 + 9); S2(c0, -c0 + 9); } else { - if (c0 == 4) - for (int c1 = 3; c1 <= 4; c1 += 1) - S1(4, c1); - S1(c0, -c0 + 9); S2(c0, -c0 + 9); } for (int c1 = max(c0 - 1, -c0 + 10); c1 <= 6; c1 += 1) diff --git a/polly/lib/External/isl/test_inputs/codegen/cloog/classen.c b/polly/lib/External/isl/test_inputs/codegen/cloog/classen.c index d51254c..3155aa7 100644 --- a/polly/lib/External/isl/test_inputs/codegen/cloog/classen.c +++ b/polly/lib/External/isl/test_inputs/codegen/cloog/classen.c @@ -4,9 +4,9 @@ if (m >= 1) { S8(0, 1); } else { S1(0, 1, 1, 1); - S4(0, 1, 2, 2, 1, 1, 2, 2); - S3(0, 1, 1, 2, 1, 1, 1, 2); S2(0, 1, 1, 1, 1, 1, 2, 1); + S3(0, 1, 1, 2, 1, 1, 1, 2); + S4(0, 1, 2, 2, 1, 1, 2, 2); S8(0, 1); } for (int c0 = 1; c0 < 2 * m - 3; c0 += 1) { @@ -17,8 +17,8 @@ if (m >= 1) { } else if (m >= c0 + 2) { S5(c0 - 1, 1, c0, 1, c0, 1, c0 + 1, 1); S1(c0, 1, c0 + 1, 1); - S4(c0, 1, c0 + 2, 2, c0 + 1, 1, c0 + 2, 2); S2(c0, 1, c0 + 1, 1, c0 + 1, 1, c0 + 2, 1); + S4(c0, 1, c0 + 2, 2, c0 + 1, 1, c0 + 2, 2); S3(c0, 1, c0 + 1, 2, c0 + 1, 1, c0 + 1, 2); } else { S5(c0 - 1, -m + c0 + 2, c0, -m + c0 + 2, m - 1, -m + c0 + 2, m, -m + c0 + 2); @@ -28,11 +28,11 @@ if (m >= 1) { } for (int c1 = max(2, -m + c0 + 3); c1 <= min(m - 1, c0); c1 += 1) { S5(c0 - 1, c1, c0, c1, c0 - c1 + 1, c1, c0 - c1 + 2, c1); - S6(c0 - 1, c1 - 1, c0, c1, c0 - c1 + 2, c1 - 1, c0 - c1 + 2, c1); S7(c0 - 1, c1 - 1, c0 + 1, c1, c0 - c1 + 2, c1 - 1, c0 - c1 + 3, c1); + S6(c0 - 1, c1 - 1, c0, c1, c0 - c1 + 2, c1 - 1, c0 - c1 + 2, c1); S1(c0, c1, c0 - c1 + 2, c1); - S4(c0, c1, c0 + 2, c1 + 1, c0 - c1 + 2, c1, c0 - c1 + 3, c1 + 1); S2(c0, c1, c0 + 1, c1, c0 - c1 + 2, c1, c0 - c1 + 3, c1); + S4(c0, c1, c0 + 2, c1 + 1, c0 - c1 + 2, c1, c0 - c1 + 3, c1 + 1); S3(c0, c1, c0 + 1, c1 + 1, c0 - c1 + 2, c1, c0 - c1 + 2, c1 + 1); } if (c0 + 1 == m) { @@ -40,19 +40,19 @@ if (m >= 1) { S6(m - 2, m - 1, m - 1, m, 1, m - 1, 1, m); S1(m - 1, m, 1, m); S2(m - 1, m, m, m, 1, m, 2, m); - } else if (m >= c0 + 2) { - S7(c0 - 1, c0, c0 + 1, c0 + 1, 1, c0, 2, c0 + 1); - S6(c0 - 1, c0, c0, c0 + 1, 1, c0, 1, c0 + 1); - S1(c0, c0 + 1, 1, c0 + 1); - S4(c0, c0 + 1, c0 + 2, c0 + 2, 1, c0 + 1, 2, c0 + 2); - S2(c0, c0 + 1, c0 + 1, c0 + 1, 1, c0 + 1, 2, c0 + 1); - S3(c0, c0 + 1, c0 + 1, c0 + 2, 1, c0 + 1, 1, c0 + 2); - } else { + } else if (c0 >= m) { S5(c0 - 1, m, c0, m, -m + c0 + 1, m, -m + c0 + 2, m); S7(c0 - 1, m - 1, c0 + 1, m, -m + c0 + 2, m - 1, -m + c0 + 3, m); S6(c0 - 1, m - 1, c0, m, -m + c0 + 2, m - 1, -m + c0 + 2, m); S1(c0, m, -m + c0 + 2, m); S2(c0, m, c0 + 1, m, -m + c0 + 2, m, -m + c0 + 3, m); + } else { + S6(c0 - 1, c0, c0, c0 + 1, 1, c0, 1, c0 + 1); + S7(c0 - 1, c0, c0 + 1, c0 + 1, 1, c0, 2, c0 + 1); + S1(c0, c0 + 1, 1, c0 + 1); + S2(c0, c0 + 1, c0 + 1, c0 + 1, 1, c0 + 1, 2, c0 + 1); + S4(c0, c0 + 1, c0 + 2, c0 + 2, 1, c0 + 1, 2, c0 + 2); + S3(c0, c0 + 1, c0 + 1, c0 + 2, 1, c0 + 1, 1, c0 + 2); } for (int c2 = max(1, -m + c0 + 2); c2 <= min(m, c0 + 1); c2 += 1) S8(c0, c2); diff --git a/polly/lib/External/isl/test_inputs/codegen/cloog/dot2.c b/polly/lib/External/isl/test_inputs/codegen/cloog/dot2.c index a1b1069..1990d26 100644 --- a/polly/lib/External/isl/test_inputs/codegen/cloog/dot2.c +++ b/polly/lib/External/isl/test_inputs/codegen/cloog/dot2.c @@ -4,9 +4,9 @@ for (int c1 = 1; c1 <= M; c1 += 1) S2(c0, c1); } - for (int c0 = N + 1; c0 <= M; c0 += 1) - S1(c0); for (int c0 = M + 1; c0 <= N; c0 += 1) for (int c1 = 1; c1 <= M; c1 += 1) S2(c0, c1); + for (int c0 = N + 1; c0 <= M; c0 += 1) + S1(c0); } diff --git a/polly/lib/External/isl/test_inputs/codegen/cloog/faber.c b/polly/lib/External/isl/test_inputs/codegen/cloog/faber.c index 3310f27..4aef0a5 100644 --- a/polly/lib/External/isl/test_inputs/codegen/cloog/faber.c +++ b/polly/lib/External/isl/test_inputs/codegen/cloog/faber.c @@ -37,16 +37,18 @@ for (int c1 = 1; c1 <= 18; c1 += 1) { for (int c2 = -8 * c1; c2 <= min(6, -8 * c1 + 24); c2 += 1) S3(c0, c1, c2); - if (c0 <= 34 && c1 == 1) { - S3(c0, 1, 7); - } else if (c1 == 2) { + if (c1 == 2) { S3(c0, 2, 7); + } else if (c0 <= 34 && c1 == 1) { + S3(c0, 1, 7); } else if (c0 >= 35 && c1 == 1) { S3(c0, 1, 7); S7(c0, 1, 7); } for (int c2 = 8; c2 <= min(-8 * c1 + 24, c1 - (6 * c0 + 77) / 77 + 12); c2 += 1) S3(c0, c1, c2); + for (int c2 = max(-8 * c1 + 25, c1 - (6 * c0 + 77) / 77 + 13); c2 <= c1 + 12; c2 += 1) + S6(c0, c1, c2); if (c1 == 1) { for (int c2 = -((6 * c0 + 77) / 77) + 14; c2 <= 13; c2 += 1) { S3(c0, 1, c2); @@ -55,8 +57,6 @@ for (int c2 = 14; c2 <= 16; c2 += 1) S3(c0, 1, c2); } - for (int c2 = max(-8 * c1 + 25, c1 - (6 * c0 + 77) / 77 + 13); c2 <= c1 + 12; c2 += 1) - S6(c0, c1, c2); for (int c2 = c1 - (3 * c0 + 14) / 14 + 49; c2 <= c1 + 48; c2 += 1) S1(c0, c1, c2); } @@ -78,6 +78,14 @@ for (int c2 = -2 * c1 + 30; c2 <= c1 - (3 * c0 + 17) / 14 + 56; c2 += 1) S1(c0, c1, c2); } + for (int c1 = c0 / 14 - 5; c1 < 0; c1 += 1) { + if (7 * c1 + 114 >= 2 * c0) + S7(c0, c1, 6); + for (int c2 = max(8, c1 - (6 * c0 + 77) / 77 + 13); c2 <= c1 - (6 * c0 + 91) / 77 + 15; c2 += 1) + S6(c0, c1, c2); + for (int c2 = c1 - (3 * c0 + 14) / 14 + 49; c2 <= c1 - (3 * c0 + 17) / 14 + 56; c2 += 1) + S1(c0, c1, c2); + } if (c0 <= 148) for (int c1 = max(0, (c0 + 5) / 14 - 8); c1 < c0 / 14 - 5; c1 += 1) { if (c1 == 0) @@ -88,14 +96,6 @@ if (c0 >= 70 && c0 % 14 >= 9) for (int c2 = max(c0 / 14 + 19, -((3 * c0 + 14) / 14) + c0 / 14 + 44); c2 <= -((3 * c0 + 17) / 14) + c0 / 14 + 51; c2 += 1) S1(c0, c0 / 14 - 5, c2); - for (int c1 = c0 / 14 - 5; c1 < 0; c1 += 1) { - if (7 * c1 + 114 >= 2 * c0) - S7(c0, c1, 6); - for (int c2 = max(8, c1 - (6 * c0 + 77) / 77 + 13); c2 <= c1 - (6 * c0 + 91) / 77 + 15; c2 += 1) - S6(c0, c1, c2); - for (int c2 = c1 - (3 * c0 + 14) / 14 + 49; c2 <= c1 - (3 * c0 + 17) / 14 + 56; c2 += 1) - S1(c0, c1, c2); - } for (int c1 = max(0, (c0 + 5) / 14 - 5); c1 < c0 / 14 - 2; c1 += 1) { for (int c2 = max(c1, -2 * c1 + 6); c2 <= min(c1 + 5, -2 * c1 + 24); c2 += 1) S9(c0, c1, c2); @@ -121,12 +121,12 @@ for (int c1 = c0 / 14 - 2; c1 <= 18; c1 += 1) { for (int c2 = max(6, (c0 + 5) / 14 + 1); c2 <= min(min(c1, c0 / 14 + 3), -c1 + c1 / 2 + 18); c2 += 1) S5(c0, c1, c2); + for (int c2 = max(c1 + (3 * c0 + 3) / 14 - 40, -c1 + (c1 + 1) / 2 + 21); c2 <= min(c1, c1 + 3 * c0 / 14 - 33); c2 += 1) + S4(c0, c1, c2); for (int c2 = c1 + 6; c2 <= min((2 * c1 + 1) / 5 + 7, (2 * c0 - 7 * c1 + 63) / 21 + 1); c2 += 1) S7(c0, c1, c2); for (int c2 = max(max(c1 + 6, c1 - (6 * c0 + 77) / 77 + 13), (2 * c1 + 1) / 5 + 9); c2 <= c1 - (6 * c0 + 91) / 77 + 15; c2 += 1) S6(c0, c1, c2); - for (int c2 = max(c1 + (3 * c0 + 3) / 14 - 40, -c1 + (c1 + 1) / 2 + 21); c2 <= min(c1, c1 + 3 * c0 / 14 - 33); c2 += 1) - S4(c0, c1, c2); for (int c2 = max(c1, c1 - (3 * c0 + 14) / 14 + 40); c2 <= min(c1 + 24, c1 - (3 * c0 + 17) / 14 + 47); c2 += 1) S8(c0, c1, c2); for (int c2 = max(c1 + 24, c1 - (3 * c0 + 14) / 14 + 49); c2 <= c1 - (3 * c0 + 17) / 14 + 56; c2 += 1) diff --git a/polly/lib/External/isl/test_inputs/codegen/cloog/gesced.c b/polly/lib/External/isl/test_inputs/codegen/cloog/gesced.c index a36715c..40cdad9 100644 --- a/polly/lib/External/isl/test_inputs/codegen/cloog/gesced.c +++ b/polly/lib/External/isl/test_inputs/codegen/cloog/gesced.c @@ -6,9 +6,9 @@ S2(c1, -N + c0); for (int c0 = 2 * N + 1; c0 <= M + N; c0 += 1) { for (int c1 = 1; c1 <= N; c1 += 1) - S3(c1, -2 * N + c0); - for (int c1 = 1; c1 <= N; c1 += 1) S2(c1, -N + c0); + for (int c1 = 1; c1 <= N; c1 += 1) + S3(c1, -2 * N + c0); } for (int c0 = M + N + 1; c0 <= M + 2 * N; c0 += 1) for (int c1 = 1; c1 <= N; c1 += 1) diff --git a/polly/lib/External/isl/test_inputs/codegen/cloog/gesced2.c b/polly/lib/External/isl/test_inputs/codegen/cloog/gesced2.c index 0baf706..eeba38e 100644 --- a/polly/lib/External/isl/test_inputs/codegen/cloog/gesced2.c +++ b/polly/lib/External/isl/test_inputs/codegen/cloog/gesced2.c @@ -6,8 +6,8 @@ for (int c1 = -c0 + 1; c1 <= 4; c1 += 1) S2(c0 + c1, c0); for (int c1 = 5; c1 <= min(M - 10, M - c0); c1 += 1) { - S1(c0, c1); S2(c0 + c1, c0); + S1(c0, c1); } for (int c1 = M - c0 + 1; c1 < M - 9; c1 += 1) S1(c0, c1); diff --git a/polly/lib/External/isl/test_inputs/codegen/cloog/mode.c b/polly/lib/External/isl/test_inputs/codegen/cloog/mode.c index bcfd318..5596b26 100644 --- a/polly/lib/External/isl/test_inputs/codegen/cloog/mode.c +++ b/polly/lib/External/isl/test_inputs/codegen/cloog/mode.c @@ -3,8 +3,8 @@ for (int c0 = 0; c0 <= M; c0 += 1) { S1(c0, c1); S2(c0, c1); } - for (int c1 = max(0, N + 1); c1 <= c0; c1 += 1) - S1(c0, c1); for (int c1 = c0 + 1; c1 <= N; c1 += 1) S2(c0, c1); + for (int c1 = max(0, N + 1); c1 <= c0; c1 += 1) + S1(c0, c1); } diff --git a/polly/lib/External/isl/test_inputs/codegen/cloog/reservoir-lim-lam1.c b/polly/lib/External/isl/test_inputs/codegen/cloog/reservoir-lim-lam1.c index 3827707..e326941 100644 --- a/polly/lib/External/isl/test_inputs/codegen/cloog/reservoir-lim-lam1.c +++ b/polly/lib/External/isl/test_inputs/codegen/cloog/reservoir-lim-lam1.c @@ -1,10 +1,10 @@ for (int c0 = -99; c0 <= 100; c0 += 1) { - if (c0 >= 1) - S2(c0, 1); - for (int c1 = max(1, -c0 + 1); c1 <= min(99, -c0 + 100); c1 += 1) { - S1(c0 + c1, c1); - S2(c0 + c1, c1 + 1); - } if (c0 <= 0) - S1(c0 + 100, 100); + S1(1, -c0 + 1); + for (int c1 = max(1, -2 * c0 + 3); c1 <= min(199, -2 * c0 + 199); c1 += 2) { + S2(((c1 - 1) / 2) + c0, (c1 + 1) / 2); + S1(((c1 + 1) / 2) + c0, (c1 + 1) / 2); + } + if (c0 >= 1) + S2(100, -c0 + 101); } diff --git a/polly/lib/External/isl/test_inputs/codegen/cloog/reservoir-liu-zhuge1.c b/polly/lib/External/isl/test_inputs/codegen/cloog/reservoir-liu-zhuge1.c index f9e59c1..84f6a25 100644 --- a/polly/lib/External/isl/test_inputs/codegen/cloog/reservoir-liu-zhuge1.c +++ b/polly/lib/External/isl/test_inputs/codegen/cloog/reservoir-liu-zhuge1.c @@ -1,17 +1,19 @@ if (M >= 0 && N >= 0) for (int c0 = -4; c0 <= 3 * M + N; c0 += 1) { - if (c0 >= 0 && 3 * M + 1 >= c0 && (c0 + 1) % 3 >= 1 && N + 1 >= (c0 + 1) % 3) - S2((c0 + 3) / 3 - 1, c0 % 3); - for (int c1 = max(-3 * M + c0 - 2, (c0 + 4) % 3); c1 <= min(min(N - 2, c0 - 2), -3 * M + c0 + 3); c1 += 3) - S2((c0 - c1 - 2) / 3, c1 + 2); - for (int c1 = max(-3 * M + c0 + 4, (c0 + 4) % 3); c1 < min(N - 1, c0 - 1); c1 += 3) { - S1((c0 - c1 + 4) / 3, c1); - S2((c0 - c1 - 2) / 3, c1 + 2); + if (c0 >= 3 * M) { + S2(M, -3 * M + c0); + } else if (3 * M >= c0 + 4 && (c0 + 1) % 3 == 0) { + S1((c0 + 4) / 3, 0); + } + for (int c1 = max(-3 * M + c0 + 3, (c0 + 6) % 3); c1 <= min(N - 1, c0); c1 += 3) { + S2((c0 - c1) / 3, c1); + S1(((c0 - c1) / 3) + 1, c1 + 1); + } + if (3 * M + N >= c0 + 3 && c0 >= N && (N - c0) % 3 == 0) { + S2((-N + c0) / 3, N); + } else if (N >= c0 + 4 && c0 >= -3) { + S1(0, c0 + 4); } - if (3 * M + N >= c0 + 4 && c0 >= N + 1 && ((-N + c0) % 3) + N >= 2 && (-N + c0) % 3 >= 1) - S1((-N + c0 - 1) / 3 + 2, ((-N + c0 - 1) % 3) + N - 1); - for (int c1 = max(max(c0 + 1, -3 * M + c0 + 4), (c0 + 4) % 3); c1 <= min(N, c0 + 4); c1 += 3) - S1((c0 - c1 + 4) / 3, c1); for (int c1 = max(-3 * M + c0, (c0 + 6) % 3); c1 <= min(N, c0); c1 += 3) S3((c0 - c1) / 3, c1); } diff --git a/polly/lib/External/isl/test_inputs/codegen/cloog/test.c b/polly/lib/External/isl/test_inputs/codegen/cloog/test.c index 84c8493..f0544ab 100644 --- a/polly/lib/External/isl/test_inputs/codegen/cloog/test.c +++ b/polly/lib/External/isl/test_inputs/codegen/cloog/test.c @@ -5,13 +5,13 @@ for (int c0 = 3; c0 <= N; c0 += 1) { for (int c1 = 1; c1 <= min(M, c0 - 1); c1 += 1) S1(c0, c1); - if (M >= c0) { + if (c0 >= M + 1) { + S2(c0, c0); + } else { S1(c0, c0); S2(c0, c0); } for (int c1 = c0 + 1; c1 <= M; c1 += 1) S1(c0, c1); - if (c0 >= M + 1) - S2(c0, c0); } } diff --git a/polly/lib/External/isl/test_inputs/codegen/cloog/vivien.c b/polly/lib/External/isl/test_inputs/codegen/cloog/vivien.c index 030a88a..3976bab 100644 --- a/polly/lib/External/isl/test_inputs/codegen/cloog/vivien.c +++ b/polly/lib/External/isl/test_inputs/codegen/cloog/vivien.c @@ -15,8 +15,8 @@ } } for (int c1 = -c0 + c0 / 2 + 3; c1 <= min(-1, n - c0); c1 += 1) { - S4(-c1, c0 + c1); S6(-c1 + 2, c0 + c1 - 2); + S4(-c1, c0 + c1); for (int c2 = 1; c2 <= -c1; c2 += 1) S5(-c1 + 1, c0 + c1 - 1, c2); } @@ -26,8 +26,8 @@ S5(-n + c0, n, c2); } if (n >= 3 && c0 == n + 2) { - S6(2, n); S1(n + 1); + S6(2, n); } else { if (c0 >= n + 3 && 2 * n >= c0 + 1) S6(-n + c0, n); @@ -37,8 +37,8 @@ if (n + 1 >= c0 && c0 <= 4) { S1(c0 - 1); } else if (c0 >= 5 && n + 1 >= c0) { - S6(2, c0 - 2); S1(c0 - 1); + S6(2, c0 - 2); } if (n + 1 >= c0) S6(1, c0 - 1); @@ -68,8 +68,8 @@ S5(c0 - c0 / 2 - 1, c0 / 2 + 1, c2); } for (int c1 = -c0 + c0 / 2 + 3; c1 <= n - c0; c1 += 1) { - S4(-c1, c0 + c1); S6(-c1 + 2, c0 + c1 - 2); + S4(-c1, c0 + c1); for (int c2 = 1; c2 <= -c1; c2 += 1) S5(-c1 + 1, c0 + c1 - 1, c2); } diff --git a/polly/lib/External/isl/test_inputs/codegen/cloog/vivien2.c b/polly/lib/External/isl/test_inputs/codegen/cloog/vivien2.c index d30183e..f13c6d7 100644 --- a/polly/lib/External/isl/test_inputs/codegen/cloog/vivien2.c +++ b/polly/lib/External/isl/test_inputs/codegen/cloog/vivien2.c @@ -10,8 +10,8 @@ S5(c0 - c0 / 2 - 1, c0 / 2 + 1, c2); } for (int c1 = -c0 + c0 / 2 + 3; c1 <= min(-1, n - c0); c1 += 1) { - S4(-c1, c0 + c1); S6(-c1 + 2, c0 + c1 - 2); + S4(-c1, c0 + c1); for (int c2 = 1; c2 <= -c1; c2 += 1) S5(-c1 + 1, c0 + c1 - 1, c2); } @@ -20,8 +20,8 @@ for (int c2 = 1; c2 < -n + c0; c2 += 1) S5(-n + c0, n, c2); if (c0 == n + 2) { - S6(2, n); S1(n + 1); + S6(2, n); } } else if (c0 + 2 >= 2 * n) { for (int c2 = 1; c2 < -n + c0; c2 += 1) @@ -31,10 +31,10 @@ S6(-n + c0, n); S1(c0 - 1); } else { - if (c0 <= 4) { + if (c0 >= 5 && n + 1 >= c0) { S1(c0 - 1); - } else if (n + 1 >= c0) { S6(2, c0 - 2); + } else if (c0 <= 4) { S1(c0 - 1); } if (n + 1 >= c0) @@ -60,8 +60,8 @@ S5(c0 - c0 / 2 - 1, c0 / 2 + 1, c2); } for (int c1 = -c0 + c0 / 2 + 3; c1 <= n - c0; c1 += 1) { - S4(-c1, c0 + c1); S6(-c1 + 2, c0 + c1 - 2); + S4(-c1, c0 + c1); for (int c2 = 1; c2 <= -c1; c2 += 1) S5(-c1 + 1, c0 + c1 - 1, c2); } diff --git a/polly/lib/External/isl/test_inputs/codegen/cloog/yosr.c b/polly/lib/External/isl/test_inputs/codegen/cloog/yosr.c index b9a4aa1..1c20057 100644 --- a/polly/lib/External/isl/test_inputs/codegen/cloog/yosr.c +++ b/polly/lib/External/isl/test_inputs/codegen/cloog/yosr.c @@ -1,10 +1,10 @@ { for (int c0 = 1; c0 < n; c0 += 1) { + for (int c2 = c0 + 1; c2 <= n; c2 += 1) + S1(c0, c2); for (int c1 = 1; c1 < c0; c1 += 1) for (int c2 = c1 + 1; c2 <= n; c2 += 1) S2(c1, c2, c0); - for (int c2 = c0 + 1; c2 <= n; c2 += 1) - S1(c0, c2); } for (int c1 = 1; c1 < n; c1 += 1) for (int c2 = c1 + 1; c2 <= n; c2 += 1) diff --git a/polly/lib/External/isl/test_inputs/codegen/cloog/yosr2.c b/polly/lib/External/isl/test_inputs/codegen/cloog/yosr2.c index a52909c..1a3e992 100644 --- a/polly/lib/External/isl/test_inputs/codegen/cloog/yosr2.c +++ b/polly/lib/External/isl/test_inputs/codegen/cloog/yosr2.c @@ -2,12 +2,12 @@ for (int c1 = 1; c1 <= M; c1 += 1) S2(c1); for (int c0 = 2; c0 <= M; c0 += 1) { + for (int c2 = 1; c2 < c0; c2 += 1) + S1(c0, c2); + for (int c1 = 1; c1 < c0; c1 += 1) + S4(c1, c0); for (int c2 = c0 + 1; c2 <= M; c2 += 1) for (int c3 = 1; c3 < c0; c3 += 1) S3(c0, c2, c3); - for (int c1 = 1; c1 < c0; c1 += 1) - S4(c1, c0); - for (int c2 = 1; c2 < c0; c2 += 1) - S1(c0, c2); } } diff --git a/polly/lib/External/isl/test_inputs/codegen/correlation.c b/polly/lib/External/isl/test_inputs/codegen/correlation.c index f821db6..e771b43 100644 --- a/polly/lib/External/isl/test_inputs/codegen/correlation.c +++ b/polly/lib/External/isl/test_inputs/codegen/correlation.c @@ -1,55 +1,45 @@ for (int c0 = 0; c0 < m; c0 += 32) for (int c1 = (n >= 32 && m >= c0 + 2) || (m == 1 && c0 == 0) ? 0 : 32 * n - 32 * floord(31 * n + 31, 32); c1 <= ((n <= -1 && c0 == 0) || (m == 1 && n >= 0 && c0 == 0) ? max(0, n - 1) : n); c1 += 32) for (int c2 = c0; c2 <= (m >= 2 && c0 + 31 >= m && n >= c1 && c1 + 31 >= n ? 2 * m - 3 : (m >= 2 * c0 + 63 && c1 <= -32 && n >= c1 && c1 + 31 >= n) || (m >= c0 + 32 && 2 * c0 + 62 >= m && n >= c1 && c1 + 31 >= n) || (n >= 0 && c0 >= 32 && m >= 2 * c0 + 63 && c1 == n) || (m >= 63 && n >= 32 && c0 == 0 && c1 == n) ? 2 * c0 + 61 : m - 1); c2 += 32) { - if (m >= 2) { - if (n <= 0 && c0 == 0 && c1 == 0) + if (n >= c1 + 32 && c1 >= 0 && 2 * c0 >= c2 + 32) { + for (int c4 = 0; c4 <= 31; c4 += 1) + for (int c5 = max(0, c0 - c2 + 1); c5 <= min(31, m - c2 - 1); c5 += 1) + S_27(c0, c2 + c5, c1 + c4); + } else if (c0 >= 32 && c1 >= 0 && c2 >= 2 * c0) { + for (int c4 = 0; c4 <= min(31, n - c1 - 1); c4 += 1) for (int c5 = 0; c5 <= min(31, m - c2 - 1); c5 += 1) - S_14(c2 + c5); - if (n >= 0 && c1 == n) { - for (int c3 = max(0, (c2 / 2) - c0 + 1); c3 <= min(31, m - c0 - 2); c3 += 1) - for (int c5 = max(0, c0 - c2 + c3); c5 <= min(31, 2 * c0 - c2 + 2 * c3 - 1); c5 += 1) - S_29(-c0 + c2 - c3 + c5, c0 + c3); - } else if (n >= c1 + 1 && c1 >= 0 && c1 + 31 >= n && c2 >= m) { - for (int c3 = max(0, (c2 / 2) - c0 + 1); c3 <= min(31, m - c0 - 2); c3 += 1) - for (int c5 = 0; c5 <= min(31, 2 * c0 - c2 + 2 * c3 - 1); c5 += 1) - S_29(-c0 + c2 - c3 + c5, c0 + c3); - } else if (c1 <= -32 && n >= c1 && c1 + 31 >= n) { - for (int c3 = max(0, (c2 / 2) - c0 + 1); c3 <= min(31, m - c0 - 2); c3 += 1) - for (int c5 = max(0, c0 - c2 + c3); c5 <= min(31, 2 * c0 - c2 + 2 * c3 - 1); c5 += 1) - S_29(-c0 + c2 - c3 + c5, c0 + c3); - } else if (n >= c1 + 1 && c1 >= 0 && m >= c2 + 1) { - for (int c3 = 0; c3 <= min(min(31, m - c0 - 2), -c0 + c2 + 30); c3 += 1) { - for (int c4 = 0; c4 <= min(31, n - c1 - 1); c4 += 1) { - if (c0 == 0 && c2 == 0 && c3 == 0) { - if (c1 == 0 && c4 == 0) - S_14(0); - S_19(c1 + c4, 0); - } - for (int c5 = max(0, c0 - c2 + c3 + 1); c5 <= min(31, m - c2 - 1); c5 += 1) { - if (c0 == 0 && c1 == 0 && c3 == 0 && c4 == 0) - S_14(c2 + c5); - if (c0 == 0 && c3 == 0) - S_19(c1 + c4, c2 + c5); - S_27(c0 + c3, c2 + c5, c1 + c4); - } - } - if (c1 + 31 >= n) - for (int c5 = max(0, c0 - c2 + c3); c5 <= min(31, 2 * c0 - c2 + 2 * c3 - 1); c5 += 1) - S_29(-c0 + c2 - c3 + c5, c0 + c3); + S_27(c0, c2 + c5, c1 + c4); + } else if (c0 == 0 && c1 >= 0) { + for (int c4 = 0; c4 <= min(31, n - c1 - 1); c4 += 1) + for (int c5 = 0; c5 <= min(31, m - c2 - 1); c5 += 1) { + if (c1 == 0 && c4 == 0) + S_14(c2 + c5); + S_19(c1 + c4, c2 + c5); + if (c2 + c5 >= 1) + S_27(0, c2 + c5, c1 + c4); } + } + if (c1 >= 0) { + for (int c3 = 1; c3 <= min(31, (c2 / 2) - c0); c3 += 1) + for (int c4 = 0; c4 <= min(31, n - c1 - 1); c4 += 1) + for (int c5 = 0; c5 <= min(31, m - c2 - 1); c5 += 1) + S_27(c0 + c3, c2 + c5, c1 + c4); + if (n >= c1 + 32) { + for (int c3 = max(1, (c2 / 2) - c0 + 1); c3 <= min(min(31, m - c0 - 2), -c0 + c2 + 30); c3 += 1) + for (int c4 = 0; c4 <= 31; c4 += 1) + for (int c5 = max(0, c0 - c2 + c3 + 1); c5 <= min(31, m - c2 - 1); c5 += 1) + S_27(c0 + c3, c2 + c5, c1 + c4); + } else if (n <= 0 && c0 == 0 && c1 == 0) { + for (int c5 = 0; c5 <= min(31, m - c2 - 1); c5 += 1) + S_14(c2 + c5); } - if (c0 + 32 >= m && n >= c1 && c1 + 31 >= n) { - for (int c5 = max(0, m - c2 - 1); c5 <= min(31, 2 * m - c2 - 3); c5 += 1) - S_29(-m + c2 + c5 + 1, m - 1); - } else if (m >= c0 + 33 && n >= c1 + 1 && c1 >= 0 && c1 + 31 >= n && c2 == c0) { - S_29(0, c0 + 31); - } - } else if (c1 >= 32 && c2 == 0) { - for (int c4 = 0; c4 <= min(31, n - c1 - 1); c4 += 1) - S_19(c1 + c4, 0); - } else if (c1 == 0 && c2 == 0) { - S_14(0); - for (int c4 = 0; c4 <= min(31, n - 1); c4 += 1) - S_19(c4, 0); } + if (n >= c1 && c1 + 31 >= n) + for (int c3 = max(0, (c2 / 2) - c0 + 1); c3 <= min(31, m - c0 - 1); c3 += 1) { + for (int c4 = max(0, -c1); c4 < n - c1; c4 += 1) + for (int c5 = max(0, c0 - c2 + c3 + 1); c5 <= min(31, m - c2 - 1); c5 += 1) + S_27(c0 + c3, c2 + c5, c1 + c4); + for (int c5 = max(0, c0 - c2 + c3); c5 <= min(31, 2 * c0 - c2 + 2 * c3 - 1); c5 += 1) + S_29(-c0 + c2 - c3 + c5, c0 + c3); + } } diff --git a/polly/lib/External/isl/test_inputs/codegen/empty.c b/polly/lib/External/isl/test_inputs/codegen/empty.c index 58f7b7b..0205735 100644 --- a/polly/lib/External/isl/test_inputs/codegen/empty.c +++ b/polly/lib/External/isl/test_inputs/codegen/empty.c @@ -1,6 +1,6 @@ for (int c0 = 0; c0 <= 10; c0 += 1) { S0(c0); + S1(c0); if (c0 == 5) S2(); - S1(c0); } diff --git a/polly/lib/External/isl/test_inputs/codegen/omega/if_then-1.c b/polly/lib/External/isl/test_inputs/codegen/omega/if_then-1.c index 18ca370..5e2cd82 100644 --- a/polly/lib/External/isl/test_inputs/codegen/omega/if_then-1.c +++ b/polly/lib/External/isl/test_inputs/codegen/omega/if_then-1.c @@ -2,8 +2,8 @@ for (int c0 = 1; c0 <= 100; c0 += 1) { if (n >= 2) s0(c0); for (int c1 = 1; c1 <= 100; c1 += 1) { + s2(c0, c1); if (n >= 2) s1(c0, c1); - s2(c0, c1); } } diff --git a/polly/lib/External/isl/test_inputs/codegen/omega/if_then-2.c b/polly/lib/External/isl/test_inputs/codegen/omega/if_then-2.c index 158b078..b3f4a24 100644 --- a/polly/lib/External/isl/test_inputs/codegen/omega/if_then-2.c +++ b/polly/lib/External/isl/test_inputs/codegen/omega/if_then-2.c @@ -2,8 +2,8 @@ for (int c0 = 1; c0 <= 100; c0 += 1) { if (n >= 2) { s0(c0); for (int c1 = 1; c1 <= 100; c1 += 1) { - s1(c0, c1); s2(c0, c1); + s1(c0, c1); } } else { for (int c1 = 1; c1 <= 100; c1 += 1) diff --git a/polly/lib/External/isl/test_inputs/codegen/omega/if_then-3.c b/polly/lib/External/isl/test_inputs/codegen/omega/if_then-3.c index bae078e..94dc201 100644 --- a/polly/lib/External/isl/test_inputs/codegen/omega/if_then-3.c +++ b/polly/lib/External/isl/test_inputs/codegen/omega/if_then-3.c @@ -2,8 +2,8 @@ if (n >= 2) { for (int c0 = 1; c0 <= 100; c0 += 1) { s0(c0); for (int c1 = 1; c1 <= 100; c1 += 1) { - s1(c0, c1); s2(c0, c1); + s1(c0, c1); } } } else { diff --git a/polly/lib/External/isl/test_inputs/codegen/omega/iter9-0.c b/polly/lib/External/isl/test_inputs/codegen/omega/iter9-0.c index d25a354..baedaa0 100644 --- a/polly/lib/External/isl/test_inputs/codegen/omega/iter9-0.c +++ b/polly/lib/External/isl/test_inputs/codegen/omega/iter9-0.c @@ -1,10 +1,10 @@ for (int c0 = 1; c0 <= 15; c0 += 1) { if (((-exprVar1 + 15) % 8) + c0 <= 15) { - s4(c0); - s0(c0); + s1(c0); s3(c0); s2(c0); - s1(c0); + s0(c0); + s4(c0); } if (((-exprVar1 + 15) % 8) + c0 <= 15 || (exprVar1 - c0 + 1) % 8 == 0) s5(c0); diff --git a/polly/lib/External/isl/test_inputs/codegen/omega/m12-1.c b/polly/lib/External/isl/test_inputs/codegen/omega/m12-1.c index eba7c8a..f72181e 100644 --- a/polly/lib/External/isl/test_inputs/codegen/omega/m12-1.c +++ b/polly/lib/External/isl/test_inputs/codegen/omega/m12-1.c @@ -10,8 +10,8 @@ } for (int c1 = 1; c1 <= m; c1 += 1) { for (int c3 = 1; c3 <= n; c3 += 1) { - s5(3, c1, 1, c3); s4(3, c1, 1, c3); + s5(3, c1, 1, c3); } for (int c3 = 1; c3 <= n; c3 += 1) { s7(3, c1, 2, c3); diff --git a/polly/lib/External/isl/test_inputs/codegen/omega/wak1-0.c b/polly/lib/External/isl/test_inputs/codegen/omega/wak1-0.c index 2c310e8..32ea68e 100644 --- a/polly/lib/External/isl/test_inputs/codegen/omega/wak1-0.c +++ b/polly/lib/External/isl/test_inputs/codegen/omega/wak1-0.c @@ -1,27 +1,27 @@ { - for (int c0 = a2; c0 <= min(min(a1 - 1, a3 - 1), b2); c0 += 1) - s1(c0); - for (int c0 = a1; c0 <= min(b1, a3 - 1); c0 += 1) { + for (int c0 = a3; c0 <= min(min(a1 - 1, b3), a2 - 1); c0 += 1) + s2(c0); + for (int c0 = a1; c0 <= min(b1, a2 - 1); c0 += 1) { s0(c0); - if (c0 >= a2 && b2 >= c0) - s1(c0); + if (c0 >= a3 && b3 >= c0) + s2(c0); } - for (int c0 = max(max(a1, b1 + 1), a2); c0 <= min(a3 - 1, b2); c0 += 1) - s1(c0); - for (int c0 = a3; c0 <= b3; c0 += 1) { + for (int c0 = max(max(a1, b1 + 1), a3); c0 <= min(b3, a2 - 1); c0 += 1) + s2(c0); + for (int c0 = a2; c0 <= b2; c0 += 1) { if (c0 >= a1 && b1 >= c0) s0(c0); - if (c0 >= a2 && b2 >= c0) - s1(c0); - s2(c0); - } - for (int c0 = max(max(a3, b3 + 1), a2); c0 <= min(a1 - 1, b2); c0 += 1) s1(c0); - for (int c0 = max(max(a1, a3), b3 + 1); c0 <= b1; c0 += 1) { + if (c0 >= a3 && b3 >= c0) + s2(c0); + } + for (int c0 = max(max(a3, a2), b2 + 1); c0 <= min(a1 - 1, b3); c0 += 1) + s2(c0); + for (int c0 = max(max(a1, a2), b2 + 1); c0 <= b1; c0 += 1) { s0(c0); - if (c0 >= a2 && b2 >= c0) - s1(c0); + if (c0 >= a3 && b3 >= c0) + s2(c0); } - for (int c0 = max(max(max(max(a1, b1 + 1), a3), b3 + 1), a2); c0 <= b2; c0 += 1) - s1(c0); + for (int c0 = max(max(max(max(a1, b1 + 1), a3), a2), b2 + 1); c0 <= b3; c0 += 1) + s2(c0); } diff --git a/polly/lib/External/isl/test_inputs/codegen/omega/wak1-1.c b/polly/lib/External/isl/test_inputs/codegen/omega/wak1-1.c index 7fdda1dd..a09f705 100644 --- a/polly/lib/External/isl/test_inputs/codegen/omega/wak1-1.c +++ b/polly/lib/External/isl/test_inputs/codegen/omega/wak1-1.c @@ -7,49 +7,49 @@ s1(c0); s2(c0); } + for (int c0 = max(max(a3, b3 + 1), a2); c0 <= min(a1 - 1, b2); c0 += 1) + s1(c0); for (int c0 = a1; c0 <= min(min(b1, a3 - 1), a2 - 1); c0 += 1) s0(c0); for (int c0 = max(a1, a2); c0 <= min(min(b1, a3 - 1), b2); c0 += 1) { s0(c0); s1(c0); } - for (int c0 = max(max(a1, b1 + 1), a2); c0 <= min(a3 - 1, b2); c0 += 1) - s1(c0); for (int c0 = max(a1, a3); c0 <= min(min(b1, b3), a2 - 1); c0 += 1) { s0(c0); s2(c0); } - for (int c0 = max(max(a1, b1 + 1), a3); c0 <= min(b3, a2 - 1); c0 += 1) - s2(c0); + for (int c0 = max(max(a1, a3), b3 + 1); c0 <= min(b1, a2 - 1); c0 += 1) + s0(c0); for (int c0 = max(max(a1, a3), a2); c0 <= min(min(b1, b3), b2); c0 += 1) { s0(c0); s1(c0); s2(c0); } - for (int c0 = max(max(max(a1, b1 + 1), a3), a2); c0 <= min(b3, b2); c0 += 1) { + for (int c0 = max(max(max(a1, a3), b3 + 1), a2); c0 <= min(b1, b2); c0 += 1) { + s0(c0); s1(c0); - s2(c0); } - for (int c0 = max(max(a3, a2), b2 + 1); c0 <= min(a1 - 1, b3); c0 += 1) - s2(c0); for (int c0 = max(max(a1, a2), b2 + 1); c0 <= min(b1, a3 - 1); c0 += 1) s0(c0); + for (int c0 = max(max(a3, a2), b2 + 1); c0 <= min(a1 - 1, b3); c0 += 1) + s2(c0); for (int c0 = max(max(max(a1, a3), a2), b2 + 1); c0 <= min(b1, b3); c0 += 1) { s0(c0); s2(c0); } - for (int c0 = max(max(max(max(a1, b1 + 1), a3), a2), b2 + 1); c0 <= b3; c0 += 1) - s2(c0); - for (int c0 = max(max(a3, b3 + 1), a2); c0 <= min(a1 - 1, b2); c0 += 1) - s1(c0); - for (int c0 = max(max(a1, a3), b3 + 1); c0 <= min(b1, a2 - 1); c0 += 1) - s0(c0); - for (int c0 = max(max(max(a1, a3), b3 + 1), a2); c0 <= min(b1, b2); c0 += 1) { + for (int c0 = max(max(max(max(a1, a3), b3 + 1), a2), b2 + 1); c0 <= b1; c0 += 1) s0(c0); + for (int c0 = max(max(a1, b1 + 1), a2); c0 <= min(a3 - 1, b2); c0 += 1) s1(c0); + for (int c0 = max(max(a1, b1 + 1), a3); c0 <= min(b3, a2 - 1); c0 += 1) + s2(c0); + for (int c0 = max(max(max(a1, b1 + 1), a3), a2); c0 <= min(b3, b2); c0 += 1) { + s1(c0); + s2(c0); } for (int c0 = max(max(max(max(a1, b1 + 1), a3), b3 + 1), a2); c0 <= b2; c0 += 1) s1(c0); - for (int c0 = max(max(max(max(a1, a3), b3 + 1), a2), b2 + 1); c0 <= b1; c0 += 1) - s0(c0); + for (int c0 = max(max(max(max(a1, b1 + 1), a3), a2), b2 + 1); c0 <= b3; c0 += 1) + s2(c0); } diff --git a/polly/lib/External/isl/test_inputs/codegen/omega/wak2-1.c b/polly/lib/External/isl/test_inputs/codegen/omega/wak2-1.c index b1f7286..58c2971 100644 --- a/polly/lib/External/isl/test_inputs/codegen/omega/wak2-1.c +++ b/polly/lib/External/isl/test_inputs/codegen/omega/wak2-1.c @@ -14,18 +14,18 @@ if (c2 >= d2 + 1) { for (int c1_0 = c2; c1_0 <= d2; c1_0 += 1) s1(c0, c1_0); } else { - for (int c1_0 = c1; c1_0 <= min(d1, c2 - 1); c1_0 += 1) - s0(c0, c1_0); for (int c1_0 = c2; c1_0 <= min(c1 - 1, d2); c1_0 += 1) s1(c0, c1_0); + for (int c1_0 = c1; c1_0 <= min(d1, c2 - 1); c1_0 += 1) + s0(c0, c1_0); for (int c1_0 = max(c1, c2); c1_0 <= min(d1, d2); c1_0 += 1) { s0(c0, c1_0); s1(c0, c1_0); } - for (int c1_0 = max(c1, d2 + 1); c1_0 <= d1; c1_0 += 1) - s0(c0, c1_0); for (int c1_0 = max(max(c1, d1 + 1), c2); c1_0 <= d2; c1_0 += 1) s1(c0, c1_0); + for (int c1_0 = max(c1, d2 + 1); c1_0 <= d1; c1_0 += 1) + s0(c0, c1_0); } } for (int c0 = max(max(a1, a2), b2 + 1); c0 <= b1; c0 += 1) diff --git a/polly/lib/External/isl/test_inputs/codegen/pldi2012/figure7_b.c b/polly/lib/External/isl/test_inputs/codegen/pldi2012/figure7_b.c index 18ca370..5e2cd82 100644 --- a/polly/lib/External/isl/test_inputs/codegen/pldi2012/figure7_b.c +++ b/polly/lib/External/isl/test_inputs/codegen/pldi2012/figure7_b.c @@ -2,8 +2,8 @@ for (int c0 = 1; c0 <= 100; c0 += 1) { if (n >= 2) s0(c0); for (int c1 = 1; c1 <= 100; c1 += 1) { + s2(c0, c1); if (n >= 2) s1(c0, c1); - s2(c0, c1); } } diff --git a/polly/lib/External/isl/test_inputs/codegen/pldi2012/figure7_c.c b/polly/lib/External/isl/test_inputs/codegen/pldi2012/figure7_c.c index 158b078..b3f4a24 100644 --- a/polly/lib/External/isl/test_inputs/codegen/pldi2012/figure7_c.c +++ b/polly/lib/External/isl/test_inputs/codegen/pldi2012/figure7_c.c @@ -2,8 +2,8 @@ for (int c0 = 1; c0 <= 100; c0 += 1) { if (n >= 2) { s0(c0); for (int c1 = 1; c1 <= 100; c1 += 1) { - s1(c0, c1); s2(c0, c1); + s1(c0, c1); } } else { for (int c1 = 1; c1 <= 100; c1 += 1) diff --git a/polly/lib/External/isl/test_inputs/codegen/pldi2012/figure7_d.c b/polly/lib/External/isl/test_inputs/codegen/pldi2012/figure7_d.c index bae078e..94dc201 100644 --- a/polly/lib/External/isl/test_inputs/codegen/pldi2012/figure7_d.c +++ b/polly/lib/External/isl/test_inputs/codegen/pldi2012/figure7_d.c @@ -2,8 +2,8 @@ if (n >= 2) { for (int c0 = 1; c0 <= 100; c0 += 1) { s0(c0); for (int c1 = 1; c1 <= 100; c1 += 1) { - s1(c0, c1); s2(c0, c1); + s1(c0, c1); } } } else { diff --git a/polly/lib/External/isl/test_inputs/codegen/separate.c b/polly/lib/External/isl/test_inputs/codegen/separate.c index 042e3e7..14d91be 100644 --- a/polly/lib/External/isl/test_inputs/codegen/separate.c +++ b/polly/lib/External/isl/test_inputs/codegen/separate.c @@ -1,8 +1,8 @@ { a(0); for (int c0 = 1; c0 <= 9; c0 += 1) { - b(c0 - 1); a(c0); + b(c0 - 1); } b(9); } diff --git a/polly/lib/External/isl/test_inputs/codegen/separate.in b/polly/lib/External/isl/test_inputs/codegen/separate.in index 58486c3..07ea4aa 100644 --- a/polly/lib/External/isl/test_inputs/codegen/separate.in +++ b/polly/lib/External/isl/test_inputs/codegen/separate.in @@ -1,3 +1,3 @@ -{ a[i] -> [i] : 0 <= i < 10; b[i] -> [i+1] : 0 <= i < 10 } +{ a[i] -> [i, 0] : 0 <= i < 10; b[i] -> [i+1, 1] : 0 <= i < 10 } { : } -{ [i] -> separate[x] } +{ [i, d] -> separate[x] } diff --git a/polly/lib/External/isl/test_inputs/codegen/separate.st b/polly/lib/External/isl/test_inputs/codegen/separate.st index 408c7d9..2eed716 100644 --- a/polly/lib/External/isl/test_inputs/codegen/separate.st +++ b/polly/lib/External/isl/test_inputs/codegen/separate.st @@ -2,3 +2,7 @@ domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }" child: schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]" options: "{ separate[x] }" + child: + sequence: + - filter: "{ a[i] }" + - filter: "{ b[i] }" diff --git a/polly/lib/External/isl/test_inputs/codegen/shift2.c b/polly/lib/External/isl/test_inputs/codegen/shift2.c index 5f3501a..a0571c9 100644 --- a/polly/lib/External/isl/test_inputs/codegen/shift2.c +++ b/polly/lib/External/isl/test_inputs/codegen/shift2.c @@ -1,44 +1,56 @@ for (int c0 = 0; c0 <= 1; c0 += 1) { - for (int c2 = 0; c2 <= length; c2 += 32) { - if (length >= c2 + 1) { - for (int c3 = 0; c3 <= length; c3 += 32) { - for (int c5 = 0; c5 <= min(31, length - c2 - 1); c5 += 1) { - for (int c6 = max(0, -c3 + 1); c6 <= min(min(31, length - c3), 2 * c2 - c3 + 2 * c5 - 1); c6 += 1) - S_0(c0, c2 + c5, c3 + c6 - 1); - if (c2 + c5 >= 1 && 2 * c2 + 2 * c5 >= c3 && c3 + 30 >= 2 * c2 + 2 * c5) { - S_3(c0, 0, c2 + c5); - if (length >= 2 * c2 + 2 * c5) + for (int c1 = 0; c1 < length - 1; c1 += 32) { + for (int c2 = c1; c2 < length; c2 += 32) { + if (c1 == 0) + for (int c3 = 0; c3 <= min(length, 2 * c2 - 31); c3 += 32) + for (int c5 = 0; c5 <= min(31, length - c2 - 1); c5 += 1) + for (int c6 = max(0, -c3 + 1); c6 <= min(31, length - c3); c6 += 1) + S_0(c0, c2 + c5, c3 + c6 - 1); + for (int c3 = 2 * c2; c3 <= min(2 * length - 2, 2 * c2 + 62); c3 += 32) + for (int c4 = 0; c4 <= min(min(31, length - c1 - 2), (c3 / 2) - c1 + 14); c4 += 1) { + if (c1 == 0 && c2 == 0 && c4 == 0) + for (int c6 = max(0, -c3 + 1); c6 <= min(31, length - c3); c6 += 1) + S_0(c0, 0, c3 + c6 - 1); + if (c1 == 0 && c3 == 2 * c2 + 32 && c4 == 0) + for (int c5 = max(0, -c2 + 1); c5 <= 15; c5 += 1) + for (int c6 = 0; c6 <= min(31, length - 2 * c2 - 32); c6 += 1) + S_0(c0, c2 + c5, 2 * c2 + c6 + 31); + for (int c5 = max((c3 / 2) - c2, c1 - c2 + c4 + 1); c5 <= min(length - c2 - 1, (c3 / 2) - c2 + 15); c5 += 1) { + if (c1 == 0 && c4 == 0) + for (int c6 = max(0, -c3 + 1); c6 <= min(length - c3, 2 * c2 - c3 + 2 * c5 - 1); c6 += 1) + S_0(c0, c2 + c5, c3 + c6 - 1); + S_3(c0, c1 + c4, c2 + c5); + if (c1 == 0 && c4 == 0 && length >= 2 * c2 + 2 * c5) S_0(c0, c2 + c5, 2 * c2 + 2 * c5 - 1); + if (c1 == 0 && c4 == 0) + for (int c6 = 2 * c2 - c3 + 2 * c5 + 1; c6 <= min(31, length - c3); c6 += 1) + S_0(c0, c2 + c5, c3 + c6 - 1); } - for (int c6 = max(0, 2 * c2 - c3 + 2 * c5 + 1); c6 <= min(31, length - c3); c6 += 1) - S_0(c0, c2 + c5, c3 + c6 - 1); + if (c1 == 0 && c3 == 2 * c2 && c4 == 0) + for (int c5 = 16; c5 <= min(31, length - c2 - 1); c5 += 1) + for (int c6 = max(0, -2 * c2 + 1); c6 <= min(31, length - 2 * c2); c6 += 1) + S_0(c0, c2 + c5, 2 * c2 + c6 - 1); + if (c1 == 0 && c3 + 30 >= 2 * length && c4 == 0) + S_4(c0); } - if (length <= 15 && c2 == 0 && c3 == 0) + if (c1 == 0) { + for (int c3 = 2 * c2 + 64; c3 <= length; c3 += 32) + for (int c5 = 0; c5 <= 31; c5 += 1) + for (int c6 = 0; c6 <= min(31, length - c3); c6 += 1) + S_0(c0, c2 + c5, c3 + c6 - 1); + if (c2 + 16 == length) S_4(c0); - if (c3 >= 2 * c2 && 2 * c2 + 32 >= c3) - for (int c4 = 1; c4 <= min(min(31, length - 2), (c3 / 2) + 14); c4 += 1) - for (int c5 = max((c3 / 2) - c2, -c2 + c4 + 1); c5 <= min(length - c2 - 1, (c3 / 2) - c2 + 15); c5 += 1) - S_3(c0, c4, c2 + c5); } - for (int c3 = max(2 * c2, -(length % 32) + length + 32); c3 <= min(2 * length - 2, 2 * c2 + 62); c3 += 32) - for (int c4 = 0; c4 <= min(31, length - 2); c4 += 1) { - for (int c5 = max((c3 / 2) - c2, -c2 + c4 + 1); c5 <= min(length - c2 - 1, (c3 / 2) - c2 + 15); c5 += 1) - S_3(c0, c4, c2 + c5); - if (c3 + 30 >= 2 * length && c4 == 0) - S_4(c0); - } - if (c2 + 16 == length) - S_4(c0); - } else if (length >= 32) { - S_4(c0); - } else { - S_4(c0); } + if (c1 == 0 && length % 32 == 0) + S_4(c0); } - for (int c1 = 32; c1 < length - 1; c1 += 32) - for (int c2 = c1; c2 < length; c2 += 32) - for (int c3 = c2; c3 <= min(length - 1, c2 + 31); c3 += 16) - for (int c4 = 0; c4 <= min(min(31, length - c1 - 2), -c1 + c3 + 14); c4 += 1) - for (int c5 = max(-c2 + c3, c1 - c2 + c4 + 1); c5 <= min(length - c2 - 1, -c2 + c3 + 15); c5 += 1) - S_3(c0, c1 + c4, c2 + c5); + if (length <= 1) + for (int c5 = 0; c5 <= length; c5 += 1) { + if (c5 == length) { + S_4(c0); + } else { + S_0(c0, 0, 0); + } + } }