-isl-0.24-69-g54aac5ac
+isl-0.24-52-gd7be01f7
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 \
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 \
+++ /dev/null
-/*
- * 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;
-}
#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
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
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;
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;
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;
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;
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;
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;
isl::checked::space aff::space() const
{
- return isl::checked::pw_aff(*this).space();
+ return isl::checked::multi_aff(*this).space();
}
isl::checked::aff aff::sub(isl::checked::aff aff2) 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();
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());
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());
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();
isl::checked::space pw_aff::space() const
{
- auto res = isl_pw_aff_get_space(get());
- return manage(res);
-}
-
-isl::checked::space pw_aff::get_space() const
-{
- return space();
+ return isl::checked::union_pw_aff(*this).space();
}
isl::checked::multi_pw_aff pw_aff::sub(const isl::checked::multi_pw_aff &multi2) 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());
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;
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;
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;
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;
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;
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;
{
if (!ptr)
exception::throw_invalid("NULL input", __FILE__, __LINE__);
- return isl::pw_aff(*this).space();
+ return isl::multi_aff(*this).space();
}
isl::aff aff::sub(isl::aff aff2) 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)
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)
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)
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)
{
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_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();
+ return isl::union_pw_aff(*this).space();
}
isl::multi_pw_aff pw_aff::sub(const isl::multi_pw_aff &multi2) 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)
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,
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,
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;
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;
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;
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:
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
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:
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
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:
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
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 }, { { } } };
*/
static Signature map_reverse = { { Range, Domain }, { { Domain, Range } } };
static Signature map_range_reverse =
- { { Domain, { Range2, Range } }, { { Domain, { Range, Range2 } } } };
+ { { Domain, { Range, Range2} }, { { Domain, { Range2, Range} } } };
/* Signatures for constructing products.
*/
{ "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 },
* 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.
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;
};
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);
aff = isl_aff_zero_on_domain(isl_local_space_from_space(isl_space_copy(space)));
if (!aff)
goto error;
- aff->v = isl_vec_set_element_si(aff->v, 2 + pos, 1);
- if (!aff->v)
- aff = isl_aff_free(aff);
+ isl_int_set_si(aff->v->el[2 + pos], 1);
res = isl_pw_aff_from_aff(aff);
isl_token_free(tok);
} else if (tok->type == ISL_TOKEN_VALUE) {
* 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)
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;
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);
* 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;
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);
* 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 dimension.
+ * to remove this dimensions.
*/
static isl_stat compute_sizes(struct isl_sched_node *node,
__isl_keep isl_set *uncompressed)
#include <ctype.h>
#include <string.h>
-#include <isl_ctx_private.h>
+#include <isl/ctx.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;
{
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)
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)
"[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
#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.
*/
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.
* 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)
{
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;
}
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);
return 0;
}
-/* Check that the union of the basic sets described by "str1" and "str2"
- * can be coalesced.
+/* A specialized coalescing test case that would result in an assertion
+ * in an earlier version of isl.
* The explicit call to isl_basic_set_union prevents the implicit
- * equality constraints in the basic maps from being detected prior
+ * 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 function was introduced.
+ * where this test case was introduced.
*/
-static isl_stat test_coalesce_union(isl_ctx *ctx, const char *str1,
- const char *str2)
+static int test_coalesce_special2(struct isl_ctx *ctx)
{
+ const char *str;
isl_basic_set *bset1, *bset2;
isl_set *set;
- bset1 = isl_basic_set_read_from_str(ctx, str1);
- bset2 = isl_basic_set_read_from_str(ctx, str2);
+ 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);
set = isl_basic_set_union(bset1, bset2);
set = isl_set_coalesce(set);
isl_set_free(set);
- 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);
+ if (!set)
+ return -1;
+ return 0;
}
/* Check that calling isl_set_coalesce does not leave other sets
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.
return -1;
if (test_coalesce_special6(ctx) < 0)
return -1;
- if (test_coalesce_special7(ctx) < 0)
- return -1;
return 0;
-# In earlier versions of isl, this test case would take an inordinate
+# In earlier version 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