Update isl to isl-0.24-69-g54aac5ac
authorRiccardo Mori <patacca@autistici.org>
Fri, 23 Jul 2021 16:46:48 +0000 (18:46 +0200)
committerRiccardo Mori <patacca@autistici.org>
Fri, 23 Jul 2021 16:46:48 +0000 (18:46 +0200)
This is needed for having the functions isl_{set,map}_n_basic_{set,map}
exported to the C++ interface

20 files changed:
polly/lib/External/isl/GIT_HEAD_ID
polly/lib/External/isl/Makefile.am
polly/lib/External/isl/Makefile.in
polly/lib/External/isl/check_parse_fail_test_templ.c [new file with mode: 0644]
polly/lib/External/isl/check_reparse_test_templ.c
polly/lib/External/isl/include/isl/aff.h
polly/lib/External/isl/include/isl/cpp-checked.h
polly/lib/External/isl/include/isl/cpp.h
polly/lib/External/isl/include/isl/map.h
polly/lib/External/isl/include/isl/set.h
polly/lib/External/isl/include/isl/typed_cpp.h
polly/lib/External/isl/interface/isl.py
polly/lib/External/isl/interface/template_cpp.cc
polly/lib/External/isl/isl_coalesce.c
polly/lib/External/isl/isl_ctx_private.h
polly/lib/External/isl/isl_input.c
polly/lib/External/isl/isl_scheduler.c
polly/lib/External/isl/isl_stream.c
polly/lib/External/isl/isl_test.c
polly/lib/External/isl/test_inputs/schedule/niewang.sc

index 56d7f7519bcf76965de77ca2917c06d3788c014d..60beb8f894c07dc2e1c77b8ba900ab72d2d3d3ed 100644 (file)
@@ -1 +1 @@
-isl-0.24-52-gd7be01f7
+isl-0.24-69-g54aac5ac
index d403e26d50263d5db970d209952252507386e5c3..3e7d7b1f5dc08280f8ec96970b24b3000163a190 100644 (file)
@@ -498,6 +498,7 @@ EXTRA_DIST = \
        bset_to_bmap.c \
        bset_from_bmap.c \
        isl_check_named_params_templ.c \
+       check_parse_fail_test_templ.c \
        check_reparse_templ.c \
        check_reparse_test_templ.c \
        check_single_reference_templ.c \
index 0abf9f221cca110f13b9de6ba2c84ad832070c8d..a2e96d6c9d2c657cd173d734d58d03c68a5daa5b 100644 (file)
@@ -1398,6 +1398,7 @@ EXTRA_DIST = \
        bset_to_bmap.c \
        bset_from_bmap.c \
        isl_check_named_params_templ.c \
+       check_parse_fail_test_templ.c \
        check_reparse_templ.c \
        check_reparse_test_templ.c \
        check_single_reference_templ.c \
diff --git a/polly/lib/External/isl/check_parse_fail_test_templ.c b/polly/lib/External/isl/check_parse_fail_test_templ.c
new file mode 100644 (file)
index 0000000..6fba085
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2021      Cerebras Systems
+ *
+ * Use of this software is governed by the MIT license
+ *
+ * Written by Sven Verdoolaege,
+ * Cerebras Systems, 1237 E Arques Ave, Sunnyvale, CA, USA
+ */
+
+#define xCAT(A,B) A ## B
+#define CAT(A,B) xCAT(A,B)
+#undef TYPE
+#define TYPE CAT(isl_,BASE)
+#define xFN(TYPE,NAME) TYPE ## _ ## NAME
+#define FN(TYPE,NAME) xFN(TYPE,NAME)
+
+#undef TESTS
+#define TESTS CAT(parse_,CAT(BASE,_fail_tests))
+
+/* Test parsing of objects of type TYPE
+ * that are expected to fail.
+ */
+static isl_stat FN(check,TESTS)(isl_ctx *ctx)
+{
+       int i, n;
+       int on_error;
+
+       on_error = isl_options_get_on_error(ctx);
+       isl_options_set_on_error(ctx, ISL_ON_ERROR_CONTINUE);
+       n = ARRAY_SIZE(TESTS);
+       for (i = 0; i < n; ++i) {
+               TYPE *obj;
+
+               obj = FN(TYPE,read_from_str)(ctx, TESTS[i]);
+               FN(TYPE,free)(obj);
+               if (obj)
+                       break;
+       }
+       isl_options_set_on_error(ctx, on_error);
+       if (i < n)
+               isl_die(ctx, isl_error_unknown,
+                       "parsing not expected to succeed",
+                       return isl_stat_error);
+
+       return isl_stat_ok;
+}
index 58c194ceae93f163cbe1cec9f5a00492540e4ceb..0a0740ac688d79b4fdad60a01be0462ca90951fc 100644 (file)
@@ -5,6 +5,7 @@
 #define xFN(TYPE,NAME) TYPE ## _ ## NAME
 #define FN(TYPE,NAME) xFN(TYPE,NAME)
 
+#undef TESTS
 #define TESTS CAT(reparse_,CAT(BASE,_tests))
 
 /* Test parsing of objects of type TYPE by printing
index cfa0851429dfe076f852c09d919da588974ab4b6..c417be16542457327254e815ea2839d116a1d575 100644 (file)
@@ -212,6 +212,7 @@ void isl_aff_dump(__isl_keep isl_aff *aff);
 isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pwaff);
 uint32_t isl_pw_aff_get_hash(__isl_keep isl_pw_aff *pa);
 __isl_give isl_space *isl_pw_aff_get_domain_space(__isl_keep isl_pw_aff *pwaff);
+__isl_export
 __isl_give isl_space *isl_pw_aff_get_space(__isl_keep isl_pw_aff *pwaff);
 
 __isl_constructor
index 54417e09df3e3e7b1d67feadc82d33893600b7f6..bde60adf04f817a1e2b97e76e27ce9ffe220b934 100644 (file)
@@ -1490,6 +1490,7 @@ public:
   inline isl::checked::map_list map_list() const;
   inline isl::checked::multi_pw_aff max_multi_pw_aff() const;
   inline isl::checked::multi_pw_aff min_multi_pw_aff() const;
+  inline class size n_basic_map() const;
   inline isl::checked::basic_map polyhedral_hull() const;
   inline isl::checked::map preimage_domain(const isl::checked::multi_aff &ma) const;
   inline isl::checked::map preimage_domain(const isl::checked::multi_pw_aff &mpa) const;
@@ -1623,6 +1624,7 @@ public:
   inline isl::checked::val max_val(const isl::checked::aff &obj) const;
   inline isl::checked::multi_pw_aff min_multi_pw_aff() const;
   inline isl::checked::val min_val(const isl::checked::aff &obj) const;
+  inline class size n_basic_set() const;
   inline isl::checked::basic_set params() const;
   inline isl::checked::multi_val plain_multi_val_if_fixed() const;
   inline isl::checked::basic_set polyhedral_hull() const;
@@ -1908,6 +1910,7 @@ public:
   inline isl::checked::map_list map_list() const;
   inline isl::checked::multi_pw_aff max_multi_pw_aff() const;
   inline isl::checked::multi_pw_aff min_multi_pw_aff() const;
+  inline class size n_basic_map() const;
   inline isl::checked::basic_map polyhedral_hull() const;
   inline isl::checked::map preimage_domain(isl::checked::multi_aff ma) const;
   inline isl::checked::map preimage_domain(isl::checked::multi_pw_aff mpa) const;
@@ -2542,6 +2545,7 @@ public:
   inline isl::checked::val min_val(const isl::checked::aff &obj) const;
   inline isl::checked::multi_val multi_val() const;
   inline isl::checked::multi_val get_multi_val() const;
+  inline class size n_basic_set() const;
   inline isl::checked::basic_set params() const;
   inline isl::checked::multi_val plain_multi_val_if_fixed() const;
   inline isl::checked::basic_set polyhedral_hull() const;
@@ -2719,6 +2723,7 @@ public:
   inline isl::checked::pw_multi_aff set_range_tuple(const std::string &id) const;
   inline class size size() const;
   inline isl::checked::space space() const;
+  inline isl::checked::space get_space() const;
   inline isl::checked::multi_pw_aff sub(const isl::checked::multi_pw_aff &multi2) const;
   inline isl::checked::multi_union_pw_aff sub(const isl::checked::multi_union_pw_aff &multi2) const;
   inline isl::checked::pw_aff sub(isl::checked::pw_aff pwaff2) const;
@@ -3488,6 +3493,7 @@ public:
   inline isl::checked::val max_val(const isl::checked::aff &obj) const;
   inline isl::checked::multi_pw_aff min_multi_pw_aff() const;
   inline isl::checked::val min_val(const isl::checked::aff &obj) const;
+  inline class size n_basic_set() const;
   inline isl::checked::set params() const;
   inline isl::checked::multi_val plain_multi_val_if_fixed() const;
   inline isl::checked::multi_val get_plain_multi_val_if_fixed() const;
@@ -4993,7 +4999,7 @@ class size aff::size() const
 
 isl::checked::space aff::space() const
 {
-  return isl::checked::multi_aff(*this).space();
+  return isl::checked::pw_aff(*this).space();
 }
 
 isl::checked::aff aff::sub(isl::checked::aff aff2) const
@@ -7677,6 +7683,11 @@ isl::checked::multi_pw_aff basic_map::min_multi_pw_aff() const
   return isl::checked::map(*this).min_multi_pw_aff();
 }
 
+class size basic_map::n_basic_map() const
+{
+  return isl::checked::map(*this).n_basic_map();
+}
+
 isl::checked::basic_map basic_map::polyhedral_hull() const
 {
   return isl::checked::map(*this).polyhedral_hull();
@@ -8291,6 +8302,11 @@ isl::checked::val basic_set::min_val(const isl::checked::aff &obj) const
   return isl::checked::set(*this).min_val(obj);
 }
 
+class size basic_set::n_basic_set() const
+{
+  return isl::checked::set(*this).n_basic_set();
+}
+
 isl::checked::basic_set basic_set::params() const
 {
   auto res = isl_basic_set_params(copy());
@@ -9534,6 +9550,12 @@ isl::checked::multi_pw_aff map::min_multi_pw_aff() const
   return manage(res);
 }
 
+class size map::n_basic_map() const
+{
+  auto res = isl_map_n_basic_map(get());
+  return manage(res);
+}
+
 isl::checked::basic_map map::polyhedral_hull() const
 {
   auto res = isl_map_polyhedral_hull(copy());
@@ -12439,6 +12461,11 @@ isl::checked::multi_val point::get_multi_val() const
   return multi_val();
 }
 
+class size point::n_basic_set() const
+{
+  return isl::checked::basic_set(*this).n_basic_set();
+}
+
 isl::checked::basic_set point::params() const
 {
   return isl::checked::basic_set(*this).params();
@@ -13290,7 +13317,13 @@ class size pw_aff::size() const
 
 isl::checked::space pw_aff::space() const
 {
-  return isl::checked::union_pw_aff(*this).space();
+  auto res = isl_pw_aff_get_space(get());
+  return manage(res);
+}
+
+isl::checked::space pw_aff::get_space() const
+{
+  return space();
 }
 
 isl::checked::multi_pw_aff pw_aff::sub(const isl::checked::multi_pw_aff &multi2) const
@@ -16217,6 +16250,12 @@ isl::checked::val set::min_val(const isl::checked::aff &obj) const
   return manage(res);
 }
 
+class size set::n_basic_set() const
+{
+  auto res = isl_set_n_basic_set(get());
+  return manage(res);
+}
+
 isl::checked::set set::params() const
 {
   auto res = isl_set_params(copy());
index 0e7c6b9d881119725504690542d563571ea5781e..42b5cb6086fdb4690e87ba94e3d7b4e564305265 100644 (file)
@@ -1555,6 +1555,7 @@ public:
   inline isl::map_list map_list() const;
   inline isl::multi_pw_aff max_multi_pw_aff() const;
   inline isl::multi_pw_aff min_multi_pw_aff() const;
+  inline unsigned n_basic_map() const;
   inline isl::basic_map polyhedral_hull() const;
   inline isl::map preimage_domain(const isl::multi_aff &ma) const;
   inline isl::map preimage_domain(const isl::multi_pw_aff &mpa) const;
@@ -1688,6 +1689,7 @@ public:
   inline isl::val max_val(const isl::aff &obj) const;
   inline isl::multi_pw_aff min_multi_pw_aff() const;
   inline isl::val min_val(const isl::aff &obj) const;
+  inline unsigned n_basic_set() const;
   inline isl::basic_set params() const;
   inline isl::multi_val plain_multi_val_if_fixed() const;
   inline isl::basic_set polyhedral_hull() const;
@@ -1973,6 +1975,7 @@ public:
   inline isl::map_list map_list() const;
   inline isl::multi_pw_aff max_multi_pw_aff() const;
   inline isl::multi_pw_aff min_multi_pw_aff() const;
+  inline unsigned n_basic_map() const;
   inline isl::basic_map polyhedral_hull() const;
   inline isl::map preimage_domain(isl::multi_aff ma) const;
   inline isl::map preimage_domain(isl::multi_pw_aff mpa) const;
@@ -2607,6 +2610,7 @@ public:
   inline isl::val min_val(const isl::aff &obj) const;
   inline isl::multi_val multi_val() const;
   inline isl::multi_val get_multi_val() const;
+  inline unsigned n_basic_set() const;
   inline isl::basic_set params() const;
   inline isl::multi_val plain_multi_val_if_fixed() const;
   inline isl::basic_set polyhedral_hull() const;
@@ -2784,6 +2788,7 @@ public:
   inline isl::pw_multi_aff set_range_tuple(const std::string &id) const;
   inline unsigned size() const;
   inline isl::space space() const;
+  inline isl::space get_space() const;
   inline isl::multi_pw_aff sub(const isl::multi_pw_aff &multi2) const;
   inline isl::multi_union_pw_aff sub(const isl::multi_union_pw_aff &multi2) const;
   inline isl::pw_aff sub(isl::pw_aff pwaff2) const;
@@ -3553,6 +3558,7 @@ public:
   inline isl::val max_val(const isl::aff &obj) const;
   inline isl::multi_pw_aff min_multi_pw_aff() const;
   inline isl::val min_val(const isl::aff &obj) const;
+  inline unsigned n_basic_set() const;
   inline isl::set params() const;
   inline isl::multi_val plain_multi_val_if_fixed() const;
   inline isl::multi_val get_plain_multi_val_if_fixed() const;
@@ -5416,7 +5422,7 @@ isl::space aff::space() const
 {
   if (!ptr)
     exception::throw_invalid("NULL input", __FILE__, __LINE__);
-  return isl::multi_aff(*this).space();
+  return isl::pw_aff(*this).space();
 }
 
 isl::aff aff::sub(isl::aff aff2) const
@@ -8980,6 +8986,13 @@ isl::multi_pw_aff basic_map::min_multi_pw_aff() const
   return isl::map(*this).min_multi_pw_aff();
 }
 
+unsigned basic_map::n_basic_map() const
+{
+  if (!ptr)
+    exception::throw_invalid("NULL input", __FILE__, __LINE__);
+  return isl::map(*this).n_basic_map();
+}
+
 isl::basic_map basic_map::polyhedral_hull() const
 {
   if (!ptr)
@@ -9896,6 +9909,13 @@ isl::val basic_set::min_val(const isl::aff &obj) const
   return isl::set(*this).min_val(obj);
 }
 
+unsigned basic_set::n_basic_set() const
+{
+  if (!ptr)
+    exception::throw_invalid("NULL input", __FILE__, __LINE__);
+  return isl::set(*this).n_basic_set();
+}
+
 isl::basic_set basic_set::params() const
 {
   if (!ptr)
@@ -11875,6 +11895,18 @@ isl::multi_pw_aff map::min_multi_pw_aff() const
   return manage(res);
 }
 
+unsigned map::n_basic_map() const
+{
+  if (!ptr)
+    exception::throw_invalid("NULL input", __FILE__, __LINE__);
+  auto saved_ctx = ctx();
+  options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
+  auto res = isl_map_n_basic_map(get());
+  if (res < 0)
+    exception::throw_last_error(saved_ctx);
+  return res;
+}
+
 isl::basic_map map::polyhedral_hull() const
 {
   if (!ptr)
@@ -16592,6 +16624,13 @@ isl::multi_val point::get_multi_val() const
   return multi_val();
 }
 
+unsigned point::n_basic_set() const
+{
+  if (!ptr)
+    exception::throw_invalid("NULL input", __FILE__, __LINE__);
+  return isl::basic_set(*this).n_basic_set();
+}
+
 isl::basic_set point::params() const
 {
   if (!ptr)
@@ -17913,7 +17952,17 @@ isl::space pw_aff::space() const
 {
   if (!ptr)
     exception::throw_invalid("NULL input", __FILE__, __LINE__);
-  return isl::union_pw_aff(*this).space();
+  auto saved_ctx = ctx();
+  options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
+  auto res = isl_pw_aff_get_space(get());
+  if (!res)
+    exception::throw_last_error(saved_ctx);
+  return manage(res);
+}
+
+isl::space pw_aff::get_space() const
+{
+  return space();
 }
 
 isl::multi_pw_aff pw_aff::sub(const isl::multi_pw_aff &multi2) const
@@ -22502,6 +22551,18 @@ isl::val set::min_val(const isl::aff &obj) const
   return manage(res);
 }
 
+unsigned set::n_basic_set() const
+{
+  if (!ptr)
+    exception::throw_invalid("NULL input", __FILE__, __LINE__);
+  auto saved_ctx = ctx();
+  options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
+  auto res = isl_set_n_basic_set(get());
+  if (res < 0)
+    exception::throw_last_error(saved_ctx);
+  return res;
+}
+
 isl::set set::params() const
 {
   if (!ptr)
index ede0463800dd906b33828fa885b3f3d01db440d9..55feb9b3b588c84756baa2d7cf8e8ecedc6303ab 100644 (file)
@@ -698,6 +698,7 @@ isl_bool isl_map_plain_is_equal(__isl_keep isl_map *map1,
 
 uint32_t isl_map_get_hash(__isl_keep isl_map *map);
 
+__isl_export
 isl_size isl_map_n_basic_map(__isl_keep isl_map *map);
 __isl_export
 isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
index 4b66b82e6f4106e794c433d04dba4e94efee69a9..3e9b224fc485815aed7cbaec26635ce32c957735 100644 (file)
@@ -512,6 +512,7 @@ isl_bool isl_set_plain_is_disjoint(__isl_keep isl_set *set1,
 
 uint32_t isl_set_get_hash(__isl_keep isl_set *set);
 
+__isl_export
 isl_size isl_set_n_basic_set(__isl_keep isl_set *set);
 __isl_export
 isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
index 165a61b5a615a94758ac82f36e780b13fec3abd4..30c47ebfc5bfcda10f8a47b5e8092ab5bce1d142 100644 (file)
@@ -7235,6 +7235,7 @@ struct pw_aff<Anonymous> : public isl::pw_aff {
   template <typename Domain2>
   inline typed::pw_multi_aff<Domain2> set_range_tuple(const std::string &id) const;
   inline typed::space<Anonymous> space() const;
+  inline typed::space<Anonymous> get_space() const = delete;
   inline typed::multi_pw_aff<Anonymous> sub(const typed::multi_pw_aff<Anonymous> &multi2) const;
   inline typed::multi_union_pw_aff<Anonymous> sub(const typed::multi_union_pw_aff<Anonymous> &multi2) const;
   inline typed::pw_aff<Anonymous> sub(const typed::pw_aff<Anonymous> &pwaff2) const;
@@ -7448,6 +7449,7 @@ struct pw_aff<Domain, Anonymous> : public isl::pw_aff {
   template <typename Range2>
   inline typed::pw_multi_aff<Domain, Range2> set_range_tuple(const std::string &id) const;
   inline typed::space<Domain, Anonymous> space() const;
+  inline typed::space<Domain, Anonymous> get_space() const = delete;
   inline typed::multi_pw_aff<Domain, Anonymous> sub(const typed::multi_pw_aff<Domain, Anonymous> &multi2) const;
   inline typed::multi_union_pw_aff<Domain, Anonymous> sub(const typed::multi_union_pw_aff<Domain, Anonymous> &multi2) const;
   inline typed::pw_aff<Domain, Anonymous> sub(const typed::pw_aff<Domain, Anonymous> &pwaff2) const;
@@ -7663,6 +7665,7 @@ struct pw_aff<pair<Domain2, Range2>, Anonymous> : public isl::pw_aff {
   template <typename Arg1>
   inline typed::pw_multi_aff<pair<Domain2, Range2>, Arg1> set_range_tuple(const std::string &id) const;
   inline typed::space<pair<Domain2, Range2>, Anonymous> space() const;
+  inline typed::space<pair<Domain2, Range2>, Anonymous> get_space() const = delete;
   inline typed::multi_pw_aff<pair<Domain2, Range2>, Anonymous> sub(const typed::multi_pw_aff<pair<Domain2, Range2>, Anonymous> &multi2) const;
   inline typed::multi_union_pw_aff<pair<Domain2, Range2>, Anonymous> sub(const typed::multi_union_pw_aff<pair<Domain2, Range2>, Anonymous> &multi2) const;
   inline typed::pw_aff<pair<Domain2, Range2>, Anonymous> sub(const typed::pw_aff<pair<Domain2, Range2>, Anonymous> &pwaff2) const;
index 13a9514679411547663ef72e5f66da47e3057024..f2249cbc7de1f6d366dac98771b96590cb5ffb15 100644 (file)
@@ -3163,6 +3163,18 @@ class pw_aff(union_pw_aff, pw_multi_aff, multi_pw_aff):
             obj = pw_aff(ctx=ctx, ptr=res)
             return obj
         raise Error
+    def space(arg0):
+        try:
+            if not arg0.__class__ is pw_aff:
+                arg0 = pw_aff(arg0)
+        except:
+            raise
+        ctx = arg0.ctx
+        res = isl.isl_pw_aff_get_space(arg0.ptr)
+        obj = space(ctx=ctx, ptr=res)
+        return obj
+    def get_space(arg0):
+        return arg0.space()
     def sub(arg0, arg1):
         try:
             if not arg0.__class__ is pw_aff:
@@ -3334,6 +3346,8 @@ isl.isl_pw_aff_scale_val.restype = c_void_p
 isl.isl_pw_aff_scale_val.argtypes = [c_void_p, c_void_p]
 isl.isl_pw_aff_scale_down_val.restype = c_void_p
 isl.isl_pw_aff_scale_down_val.argtypes = [c_void_p, c_void_p]
+isl.isl_pw_aff_get_space.restype = c_void_p
+isl.isl_pw_aff_get_space.argtypes = [c_void_p]
 isl.isl_pw_aff_sub.restype = c_void_p
 isl.isl_pw_aff_sub.argtypes = [c_void_p, c_void_p]
 isl.isl_pw_aff_subtract_domain.restype = c_void_p
@@ -8635,6 +8649,17 @@ class map(union_map):
         res = isl.isl_map_min_multi_pw_aff(isl.isl_map_copy(arg0.ptr))
         obj = multi_pw_aff(ctx=ctx, ptr=res)
         return obj
+    def n_basic_map(arg0):
+        try:
+            if not arg0.__class__ is map:
+                arg0 = map(arg0)
+        except:
+            raise
+        ctx = arg0.ctx
+        res = isl.isl_map_n_basic_map(arg0.ptr)
+        if res < 0:
+            raise
+        return int(res)
     def polyhedral_hull(arg0):
         try:
             if not arg0.__class__ is map:
@@ -9072,6 +9097,7 @@ isl.isl_map_max_multi_pw_aff.restype = c_void_p
 isl.isl_map_max_multi_pw_aff.argtypes = [c_void_p]
 isl.isl_map_min_multi_pw_aff.restype = c_void_p
 isl.isl_map_min_multi_pw_aff.argtypes = [c_void_p]
+isl.isl_map_n_basic_map.argtypes = [c_void_p]
 isl.isl_map_polyhedral_hull.restype = c_void_p
 isl.isl_map_polyhedral_hull.argtypes = [c_void_p]
 isl.isl_map_preimage_domain_multi_aff.restype = c_void_p
@@ -10538,6 +10564,17 @@ class set(union_set):
         res = isl.isl_set_min_val(arg0.ptr, arg1.ptr)
         obj = val(ctx=ctx, ptr=res)
         return obj
+    def n_basic_set(arg0):
+        try:
+            if not arg0.__class__ is set:
+                arg0 = set(arg0)
+        except:
+            raise
+        ctx = arg0.ctx
+        res = isl.isl_set_n_basic_set(arg0.ptr)
+        if res < 0:
+            raise
+        return int(res)
     def params(arg0):
         try:
             if not arg0.__class__ is set:
@@ -10908,6 +10945,7 @@ isl.isl_set_min_multi_pw_aff.restype = c_void_p
 isl.isl_set_min_multi_pw_aff.argtypes = [c_void_p]
 isl.isl_set_min_val.restype = c_void_p
 isl.isl_set_min_val.argtypes = [c_void_p, c_void_p]
+isl.isl_set_n_basic_set.argtypes = [c_void_p]
 isl.isl_set_params.restype = c_void_p
 isl.isl_set_params.argtypes = [c_void_p]
 isl.isl_set_get_plain_multi_val_if_fixed.restype = c_void_p
index bf138032b7ae28c20b6214832c0796bcd7753da0..debbfcd284400576d966dce4d863f7b2d17d4df5 100644 (file)
@@ -541,7 +541,7 @@ static Signature map_from_range_and_domain =
 static Signature map_from_domain_and_range =
        { { Domain, Range }, { { Domain }, { Range } } };
 
-/* Signatures for creating an anonymous set from a parameter set.
+/* Signatures for creating an anonymous set from a parameter set
  * or a map from a domain, where the range is anonymous.
  */
 static Signature anonymous_set_from_params = { { Anonymous }, { { } } };
@@ -592,7 +592,7 @@ static std::vector<Signature> fn_domain = { domain, set_params };
  */
 static Signature map_reverse = { { Range, Domain }, { { Domain, Range } } };
 static Signature map_range_reverse =
-       { { Domain, { Range, Range2} }, { { Domain, { Range2, Range} } } };
+       { { Domain, { Range2, Range } }, { { Domain, { Range, Range2 } } } };
 
 /* Signatures for constructing products.
  */
@@ -850,10 +850,10 @@ member_methods {
        { "range_lattice_tile", { un_map } },
        { "range_map",          { range_map } },
        { "range_product",      { range_product } },
+       { "range_reverse",      { map_range_reverse } },
        { "range_simple_fixed_box_hull",
                                { un_map } },
        { "reverse",            { map_reverse } },
-       { "range_reverse",      { map_range_reverse } },
        { "scale",              bin_val },
        { "scale_down",         bin_val },
        { "set_at",             set_at },
index e7cefa0dcc47b7107eb048955b2e1530ed9163cd..910c2146bd5a9625a22954da8ae45ce1ba9a70a8 100644 (file)
@@ -1526,6 +1526,9 @@ static isl_bool has_redundant_cuts(struct isl_coalesce_info *info)
  * If "add_valid" is set, then the offending constraints are
  * simply removed.
  *
+ * If the facet turns out to be empty, then no wrapping can be performed.
+ * This is considered a failure, unless "add_valid" is set.
+ *
  * If any of the cut constraints of info->bmap turn out
  * to be redundant with respect to other constraints
  * then these will neither be wrapped nor added directly to the result.
@@ -1550,6 +1553,11 @@ static isl_stat add_selected_wraps_around_facet(struct isl_wraps *wraps,
                return isl_stat_error;
        if (isl_tab_detect_redundant(info->tab) < 0)
                return isl_stat_error;
+       if (info->tab->empty) {
+               if (!add_valid)
+                       return wraps_mark_failed(wraps);
+               return isl_stat_ok;
+       }
        nowrap = has_redundant_cuts(info);
        if (nowrap < 0)
                return isl_stat_error;
index 7c66f36c999eaad5b445a50175ff4b6b60cde7d5..5083a965e9272e079a4ee3f58392ae3a9b31cb1a 100644 (file)
@@ -42,3 +42,6 @@ struct isl_ctx {
 };
 
 int isl_ctx_next_operation(isl_ctx *ctx);
+
+void isl_ctx_set_full_error(isl_ctx *ctx, enum isl_error error, const char *msg,
+       const char *file, int line);
index 4ac2bdd7e65315185911eba7b8d5763bd8575c5c..4c6839d15d8f16447f20a5a41c00d5c05f583faf 100644 (file)
@@ -509,7 +509,9 @@ static __isl_give isl_pw_aff *accept_affine_factor(__isl_keep isl_stream *s,
                aff = isl_aff_zero_on_domain(isl_local_space_from_space(isl_space_copy(space)));
                if (!aff)
                        goto error;
-               isl_int_set_si(aff->v->el[2 + pos], 1);
+               aff->v = isl_vec_set_element_si(aff->v, 2 + pos, 1);
+               if (!aff->v)
+                       aff = isl_aff_free(aff);
                res = isl_pw_aff_from_aff(aff);
                isl_token_free(tok);
        } else if (tok->type == ISL_TOKEN_VALUE) {
@@ -3679,6 +3681,9 @@ static __isl_give isl_multi_pw_aff *extract_mpa_from_tuple(
  * through a call to extract_mpa_from_tuple.
  * The result is converted to an isl_pw_multi_aff and
  * its domain is intersected with the domain.
+ *
+ * Note that the last tuple may introduce new identifiers,
+ * but these cannot be referenced in the description of the domain.
  */
 static __isl_give isl_pw_multi_aff *read_conditional_multi_aff(
        __isl_keep isl_stream *s, __isl_take isl_set *dom, struct vars *v)
@@ -3687,13 +3692,16 @@ static __isl_give isl_pw_multi_aff *read_conditional_multi_aff(
        isl_multi_pw_aff *mpa;
        isl_pw_multi_aff *pma;
        int n = v->n;
+       int n_dom;
 
+       n_dom = v->n;
        tuple = read_tuple(s, v, 0, 0);
        if (!tuple)
                goto error;
        if (isl_stream_eat_if_available(s, ISL_TOKEN_TO)) {
                isl_map *map = map_from_tuple(tuple, dom, isl_dim_in, v, 0);
                dom = isl_map_domain(map);
+               n_dom = v->n;
                tuple = read_tuple(s, v, 0, 0);
                if (!tuple)
                        goto error;
@@ -3703,6 +3711,7 @@ static __isl_give isl_pw_multi_aff *read_conditional_multi_aff(
        if (!mpa)
                dom = isl_set_free(dom);
 
+       vars_drop(v, v->n - n_dom);
        dom = read_optional_formula(s, dom, v, 0);
 
        vars_drop(v, v->n - n);
@@ -3987,10 +3996,14 @@ __isl_give isl_multi_aff *isl_multi_aff_read_from_str(isl_ctx *ctx,
  * is then converted into the isl_multi_pw_aff through a call
  * to extract_mpa_from_tuple and the domain of the result
  * is intersected with the domain.
+ *
+ * Note that the last tuple may introduce new identifiers,
+ * but these cannot be referenced in the description of the domain.
  */
 __isl_give isl_multi_pw_aff *isl_stream_read_multi_pw_aff(
        __isl_keep isl_stream *s)
 {
+       int n_dom;
        struct vars *v;
        isl_set *dom = NULL;
        isl_multi_pw_aff *tuple = NULL;
@@ -4009,17 +4022,20 @@ __isl_give isl_multi_pw_aff *isl_stream_read_multi_pw_aff(
        if (isl_stream_eat(s, '{'))
                goto error;
 
+       n_dom = v->n;
        tuple = read_tuple(s, v, 0, 0);
        if (!tuple)
                goto error;
        if (isl_stream_eat_if_available(s, ISL_TOKEN_TO)) {
                isl_map *map = map_from_tuple(tuple, dom, isl_dim_in, v, 0);
                dom = isl_map_domain(map);
+               n_dom = v->n;
                tuple = read_tuple(s, v, 0, 0);
                if (!tuple)
                        goto error;
        }
 
+       vars_drop(v, v->n - n_dom);
        if (isl_stream_eat_if_available(s, ':'))
                dom = read_formula(s, v, dom, 0);
 
index 010881173c6a2f342f1c5871768fc3af14709c9b..5ab65d22522b47bb521b883e9df72f3c8fda9953 100644 (file)
@@ -1106,7 +1106,7 @@ static isl_stat project_out_fixed(struct isl_sched_node *node,
  * If any of the sizes turns out to be zero, then this means
  * that this dimension has a fixed value in terms of
  * the other dimensions.  Perform an (extra) compression
- * to remove this dimensions.
+ * to remove this dimension.
  */
 static isl_stat compute_sizes(struct isl_sched_node *node,
        __isl_keep isl_set *uncompressed)
index 5f2732b31d7797165d3691e2f5259b100d85119f..1052360aa326af851123074fc6ba227e1024b94b 100644 (file)
@@ -9,11 +9,12 @@
 
 #include <ctype.h>
 #include <string.h>
-#include <isl/ctx.h>
+#include <isl_ctx_private.h>
 #include <isl_stream_private.h>
 #include <isl/map.h>
 #include <isl/aff.h>
 #include <isl_val_private.h>
+#include <isl_options_private.h>
 
 struct isl_keyword {
        char                    *name;
@@ -134,6 +135,12 @@ void isl_stream_error(__isl_keep isl_stream *s, struct isl_token *tok,
 {
        int line = tok ? tok->line : s->line;
        int col = tok ? tok->col : s->col;
+
+       isl_ctx_set_full_error(s->ctx, isl_error_invalid, "syntax error",
+                               __FILE__, __LINE__);
+
+       if (s->ctx->opt->on_error == ISL_ON_ERROR_CONTINUE)
+               return;
        fprintf(stderr, "syntax error (%d, %d): %s\n", line, col, msg);
        if (tok) {
                if (tok->type < 256)
@@ -165,6 +172,8 @@ void isl_stream_error(__isl_keep isl_stream *s, struct isl_token *tok,
                else
                        fprintf(stderr, "got token type %d\n", tok->type);
        }
+       if (s->ctx->opt->on_error == ISL_ON_ERROR_ABORT)
+               abort();
 }
 
 static __isl_give isl_stream* isl_stream_new(struct isl_ctx *ctx)
index 4d82f1eba915666a03c4d56a02975689e2f3efd7..2d0965097c47b0bce02362d650c24243de4edbe7 100644 (file)
@@ -135,6 +135,8 @@ static const char *reparse_multi_pw_aff_tests[] = {
        "[N] -> { [N] : N >= 0 }",
        "[N] -> { [N, N + 1] : N >= 0 }",
        "[N, M] -> { [(N : N >= 0), (M : M >= 0)] : N + M >= 0 }",
+       "{ [a] -> [b = a] }",
+       "{ [a] -> [b = a] : a >= 0 }",
 };
 
 #undef BASE
@@ -143,6 +145,16 @@ static const char *reparse_multi_pw_aff_tests[] = {
 #include "check_reparse_templ.c"
 #include "check_reparse_test_templ.c"
 
+/* String descriptions that cannot be parsed
+ * as multi piecewise affine expressions.
+ */
+static const char *parse_multi_pw_aff_fail_tests[] = {
+       "{ [a] -> [b] : b = a }",
+       "{ [a] -> [b = a] : b >= 0 }",
+};
+
+#include "check_parse_fail_test_templ.c"
+
 /* String descriptions of piecewise multi affine expressions
  * that are used for testing printing and parsing.
  */
@@ -184,6 +196,31 @@ static isl_stat test_parse_pma(isl_ctx *ctx)
        return isl_stat_ok;
 }
 
+/* String descriptions that cannot be parsed
+ * as union piecewise multi affine expressions.
+ */
+static const char *parse_union_pw_multi_aff_fail_tests[] = {
+       "{ [a] -> [b] : b = a }",
+       "{ [a] -> [b = a] : b >= 0 }",
+};
+
+#undef BASE
+#define BASE union_pw_multi_aff
+
+#include "check_parse_fail_test_templ.c"
+
+/* Test parsing of union piecewise multi affine expressions.
+ *
+ * In particular, check some cases where parsing is supposed to fail.
+ */
+static isl_stat test_parse_upma(isl_ctx *ctx)
+{
+       if (check_parse_union_pw_multi_aff_fail_tests(ctx) < 0)
+               return isl_stat_error;
+
+       return isl_stat_ok;
+}
+
 /* Test parsing of multi piecewise affine expressions by printing
  * the expressions and checking that parsing the output results
  * in the same expression.
@@ -191,6 +228,8 @@ static isl_stat test_parse_pma(isl_ctx *ctx)
  * an expression converted from a map with an output dimension name
  * that is equal to an automatically generated name, and
  * a set of expressions parsed from strings.
+ *
+ * Additionally, check some cases where parsing is supposed to fail.
  */
 static int test_parse_mpa(isl_ctx *ctx)
 {
@@ -227,6 +266,8 @@ static int test_parse_mpa(isl_ctx *ctx)
 
        if (check_reparse_multi_pw_aff_tests(ctx) < 0)
                return -1;
+       if (check_parse_multi_pw_aff_fail_tests(ctx) < 0)
+               return -1;
 
        return 0;
 }
@@ -418,6 +459,8 @@ int test_parse(struct isl_ctx *ctx)
                return -1;
        if (test_parse_pma(ctx) < 0)
                return -1;
+       if (test_parse_upma(ctx) < 0)
+               return -1;
 
        str = "{ [i] -> [-i] }";
        map = isl_map_read_from_str(ctx, str);
@@ -2375,30 +2418,43 @@ static int test_coalesce_special(struct isl_ctx *ctx)
        return 0;
 }
 
-/* A specialized coalescing test case that would result in an assertion
- * in an earlier version of isl.
+/* Check that the union of the basic sets described by "str1" and "str2"
+ * can be coalesced.
  * The explicit call to isl_basic_set_union prevents the implicit
- * equality constraints in the first basic map from being detected prior
+ * equality constraints in the basic maps from being detected prior
  * to the call to isl_set_coalesce, at least at the point
- * where this test case was introduced.
+ * where this function was introduced.
  */
-static int test_coalesce_special2(struct isl_ctx *ctx)
+static isl_stat test_coalesce_union(isl_ctx *ctx, const char *str1,
+       const char *str2)
 {
-       const char *str;
        isl_basic_set *bset1, *bset2;
        isl_set *set;
 
-       str = "{ [x, y] : x, y >= 0 and x + 2y <= 1 and 2x + y <= 1 }";
-       bset1 = isl_basic_set_read_from_str(ctx, str);
-       str = "{ [x,0] : -1 <= x <= 1 and x mod 2 = 1 }" ;
-       bset2 = isl_basic_set_read_from_str(ctx, str);
+       bset1 = isl_basic_set_read_from_str(ctx, str1);
+       bset2 = isl_basic_set_read_from_str(ctx, str2);
        set = isl_basic_set_union(bset1, bset2);
        set = isl_set_coalesce(set);
        isl_set_free(set);
 
-       if (!set)
-               return -1;
-       return 0;
+       return isl_stat_non_null(set);
+}
+
+/* A specialized coalescing test case that would result in an assertion
+ * in an earlier version of isl.  Use test_coalesce_union with
+ * an explicit call to isl_basic_set_union to prevent the implicit
+ * equality constraints in the first basic map from being detected prior
+ * to the call to isl_set_coalesce, at least at the point
+ * where this test case was introduced.
+ */
+static isl_stat test_coalesce_special2(struct isl_ctx *ctx)
+{
+       const char *str1;
+       const char *str2;
+
+       str1 = "{ [x, y] : x, y >= 0 and x + 2y <= 1 and 2x + y <= 1 }";
+       str2 = "{ [x,0] : -1 <= x <= 1 and x mod 2 = 1 }";
+       return test_coalesce_union(ctx, str1, str2);
 }
 
 /* Check that calling isl_set_coalesce does not leave other sets
@@ -2510,6 +2566,25 @@ static isl_stat test_coalesce_special6(isl_ctx *ctx)
        return test_coalesce_intersection(ctx, s1, s2);
 }
 
+/* A specialized coalescing test case that would result in an assertion failure
+ * in an earlier version of isl.  Use test_coalesce_union with
+ * an explicit call to isl_basic_set_union to prevent the implicit
+ * equality constraints in the basic maps from being detected prior
+ * to the call to isl_set_coalesce, at least at the point
+ * where this test case was introduced.
+ */
+static isl_stat test_coalesce_special7(isl_ctx *ctx)
+{
+       const char *str1;
+       const char *str2;
+
+       str1 = "{ [a, b, c=0:17] : a <= 7 and 2b <= 11 - a and "
+                       "c <= -7 + 2a and 2c >= - 3 + 3a - 2b }";
+       str2 = "{ [a, b, c] : c > -15a and c >= -7 + 2a and c < 0 and "
+                       "3c <= -5 + 5a - 3b and 2b >= 11 - a }";
+       return test_coalesce_union(ctx, str1, str2);
+}
+
 /* Test the functionality of isl_set_coalesce.
  * That is, check that the output is always equal to the input
  * and in some cases that the result consists of a single disjunct.
@@ -2539,6 +2614,8 @@ static int test_coalesce(struct isl_ctx *ctx)
                return -1;
        if (test_coalesce_special6(ctx) < 0)
                return -1;
+       if (test_coalesce_special7(ctx) < 0)
+               return -1;
 
 
        return 0;
index 776f2e8f7ef10048a1fc6b359ef8e832ac51256b..816cd234c748bffcd62d4d4826277561d93a83d1 100644 (file)
@@ -1,4 +1,4 @@
-# In earlier version of isl, this test case would take an inordinate
+# In earlier versions of isl, this test case would take an inordinate
 # amount of time (in the order of 30s versus 0.1s in later versions)
 # due to a call to isl_basic_set_coefficients.
 # Check that this no longer happens in the sense that this test case