From 9043b59e4de5587c954c865b183fe5339064a19f Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 25 Aug 2011 19:21:05 +0200 Subject: [PATCH] explicitly differentiate between spaces of maps, sets and parameter sets Before, no distinction was made internally between spaces of maps, sets and parameter spaces. In particular, an isl_space with zero input and output dimensions could have been any of those. When printing isl_sets and isl_maps, we could keep track of whether the original object as a set or a map, but parametric domains and zero-dimensional domains were still printed identically. Now we explicitly keep track of whether a space is supposed to be that of a map, set or parametric set. This means for example that "[N] -> { [] : N >= 0 }" and "[N] -> { : N >= 0 }" are no longer considered to be identical. This may break some code that was using one space in place of another, especially since until recently there was no official way of creating a parameter space. The main advantage is that we can now recognize parameter spaces and treat them appropriately. In particular, the domains of affine expressions can now be correctly identified as being either (possibly zero-dimensional) sets or parameter domains. Signed-off-by: Sven Verdoolaege --- doc/user.pod | 21 +++++++++ include/isl/set.h | 1 + include/isl/space.h | 3 ++ isl_aff.c | 20 ++++++++- isl_id.c | 11 +++++ isl_id_private.h | 2 + isl_input.c | 2 +- isl_map.c | 58 ++++++++++++++++++++++++- isl_output.c | 62 +++++++++++++++++---------- isl_space.c | 120 ++++++++++++++++++++++++++++++++++++++++++++++------ 10 files changed, 258 insertions(+), 42 deletions(-) diff --git a/doc/user.pod b/doc/user.pod index 39871788..3e2a4c88 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -104,6 +104,14 @@ along with the associated functions. Some of the old names have been kept for backward compatibility, but they will be removed in the future. +=item * Spaces of maps, sets and parameter domains are now +treated differently. The distinction between map spaces and set spaces +has always been made on a conceptual level, but proper use of such spaces +was never checked. Furthermore, up until isl-0.07 there was no way +of explicitly creating a parameter space. These can now be created +directly using C or from other spaces using +C. + =back =head1 Installation @@ -488,6 +496,13 @@ C, C (only for relations), C (only for relations), C (only for sets) or C. +To check whether a given space is that of a set or a map +or whether it is a parameter space, use these functions: + + #include + int isl_space_is_params(__isl_keep isl_space *space); + int isl_space_is_set(__isl_keep isl_space *space); + It is often useful to create objects that live in the same space as some other object. This can be accomplished by creating the new objects @@ -1501,6 +1516,12 @@ is already known to be empty. Check if the relation obviously lies on a hyperplane where the given dimension has a fixed value and if so, return that value in C<*val>. +=item * Space + +To check whether a set is a parameter domain, use this function: + + int isl_set_is_params(__isl_keep isl_set *set); + =item * Wrapping The following functions check whether the domain of the given diff --git a/include/isl/set.h b/include/isl/set.h index abfad86e..567eee05 100644 --- a/include/isl/set.h +++ b/include/isl/set.h @@ -300,6 +300,7 @@ int isl_set_plain_is_empty(__isl_keep isl_set *set); int isl_set_fast_is_empty(__isl_keep isl_set *set); int isl_set_plain_is_universe(__isl_keep isl_set *set); int isl_set_fast_is_universe(__isl_keep isl_set *set); +int isl_set_is_params(__isl_keep isl_set *set); int isl_set_is_empty(__isl_keep isl_set *set); int isl_set_is_bounded(__isl_keep isl_set *set); int isl_set_is_subset(__isl_keep isl_set *set1, __isl_keep isl_set *set2); diff --git a/include/isl/space.h b/include/isl/space.h index ce38f33b..2ca7f950 100644 --- a/include/isl/space.h +++ b/include/isl/space.h @@ -40,6 +40,9 @@ __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx, unsigned nparam); __isl_give isl_space *isl_space_copy(__isl_keep isl_space *dim); void isl_space_free(__isl_take isl_space *dim); +int isl_space_is_params(__isl_keep isl_space *space); +int isl_space_is_set(__isl_keep isl_space *space); + __isl_give isl_space *isl_space_set_tuple_name(__isl_take isl_space *dim, enum isl_dim_type type, const char *s); const char *isl_space_get_tuple_name(__isl_keep isl_space *dim, diff --git a/isl_aff.c b/isl_aff.c index a10789ec..4ebf7b3e 100644 --- a/isl_aff.c +++ b/isl_aff.c @@ -1276,7 +1276,7 @@ __isl_give isl_pw_aff *isl_pw_aff_union_opt(__isl_take isl_pw_aff *pwaff1, /* Construct a map with as domain the domain of pwaff and * one-dimensional range corresponding to the affine expressions. */ -__isl_give isl_map *isl_map_from_pw_aff(__isl_take isl_pw_aff *pwaff) +static __isl_give isl_map *map_from_pw_aff(__isl_take isl_pw_aff *pwaff) { int i; isl_space *dim; @@ -1306,13 +1306,29 @@ __isl_give isl_map *isl_map_from_pw_aff(__isl_take isl_pw_aff *pwaff) return map; } +/* Construct a map with as domain the domain of pwaff and + * one-dimensional range corresponding to the affine expressions. + */ +__isl_give isl_map *isl_map_from_pw_aff(__isl_take isl_pw_aff *pwaff) +{ + if (isl_space_is_params(pwaff->dim)) + isl_die(isl_pw_aff_get_ctx(pwaff), isl_error_invalid, + "space of input is not a map", + return isl_pw_aff_free(pwaff)); + return map_from_pw_aff(pwaff); +} + /* Construct a one-dimensional set with as parameter domain * the domain of pwaff and the single set dimension * corresponding to the affine expressions. */ __isl_give isl_set *isl_set_from_pw_aff(__isl_take isl_pw_aff *pwaff) { - return isl_map_from_pw_aff(pwaff); + if (!isl_space_is_params(pwaff->dim)) + isl_die(isl_pw_aff_get_ctx(pwaff), isl_error_invalid, + "space of input is not a set", + return isl_pw_aff_free(pwaff)); + return map_from_pw_aff(pwaff); } /* Return a set containing those elements in the domain diff --git a/isl_id.c b/isl_id.c index 8149e691..ef03330e 100644 --- a/isl_id.c +++ b/isl_id.c @@ -11,6 +11,17 @@ #include #include +/* A special, static isl_id to use as domains (and ranges) + * of sets and parameters domains. + * The user should never get a hold on this isl_id. + */ +isl_id isl_id_none = { + .ref = -1, + .ctx = NULL, + .name = "#none", + .user = NULL +}; + isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id) { return id ? id->ctx : NULL; diff --git a/isl_id_private.h b/isl_id_private.h index 6fb17937..a472d770 100644 --- a/isl_id_private.h +++ b/isl_id_private.h @@ -23,4 +23,6 @@ struct isl_id { uint32_t isl_hash_id(uint32_t hash, __isl_keep isl_id *id); +extern isl_id isl_id_none; + #endif diff --git a/isl_input.c b/isl_input.c index e8cb00e2..7f190ccc 100644 --- a/isl_input.c +++ b/isl_input.c @@ -685,7 +685,7 @@ static __isl_give isl_map *read_var_list(struct isl_stream *s, struct isl_token *tok; if (isl_stream_next_token_is(s, ']')) - return map; + return isl_map_add_dims(map, type, 0); while ((tok = next_token(s)) != NULL) { int new_name = 0; diff --git a/isl_map.c b/isl_map.c index 9c7fa81e..19d0d5b4 100644 --- a/isl_map.c +++ b/isl_map.c @@ -609,6 +609,24 @@ int isl_basic_set_is_rational(__isl_keep isl_basic_set *bset) return isl_basic_map_is_rational(bset); } +/* Is this basic set a parameter domain? + */ +int isl_basic_set_is_params(__isl_keep isl_basic_set *bset) +{ + if (!bset) + return -1; + return isl_space_is_params(bset->dim); +} + +/* Is this set a parameter domain? + */ +int isl_set_is_params(__isl_keep isl_set *set) +{ + if (!set) + return -1; + return isl_space_is_params(set->dim); +} + static struct isl_basic_map *basic_map_init(struct isl_ctx *ctx, struct isl_basic_map *bmap, unsigned extra, unsigned n_eq, unsigned n_ineq) @@ -4064,6 +4082,9 @@ __isl_give isl_basic_set *isl_basic_set_params(__isl_take isl_basic_set *bset) isl_space *space; unsigned n; + if (isl_basic_set_is_params(bset)) + return bset; + n = isl_basic_set_dim(bset, isl_dim_set); bset = isl_basic_set_project_out(bset, isl_dim_set, 0, n); space = isl_basic_set_get_space(bset); @@ -4079,6 +4100,9 @@ __isl_give isl_set *isl_set_params(__isl_take isl_set *set) isl_space *space; unsigned n; + if (isl_set_is_params(set)) + return set; + n = isl_set_dim(set, isl_dim_set); set = isl_set_project_out(set, isl_dim_set, 0, n); space = isl_set_get_space(set); @@ -4115,11 +4139,22 @@ int isl_basic_map_may_be_set(__isl_keep isl_basic_map *bmap) return isl_space_may_be_set(bmap->dim); } +/* Is this basic map actually a set? + * Users should never call this function. Outside of isl, + * the type should indicate whether something is a set or a map. + */ +int isl_basic_map_is_set(__isl_keep isl_basic_map *bmap) +{ + if (!bmap) + return -1; + return isl_space_is_set(bmap->dim); +} + struct isl_basic_set *isl_basic_map_range(struct isl_basic_map *bmap) { if (!bmap) return NULL; - if (isl_basic_map_may_be_set(bmap)) + if (isl_basic_map_is_set(bmap)) return bmap; return isl_basic_map_domain(isl_basic_map_reverse(bmap)); } @@ -4207,6 +4242,17 @@ int isl_map_may_be_set(__isl_keep isl_map *map) return isl_space_may_be_set(map->dim); } +/* Is this map actually a set? + * Users should never call this function. Outside of isl, + * the type should indicate whether something is a set or a map. + */ +int isl_map_is_set(__isl_keep isl_map *map) +{ + if (!map) + return -1; + return isl_space_is_set(map->dim); +} + struct isl_set *isl_map_range(struct isl_map *map) { int i; @@ -4214,7 +4260,7 @@ struct isl_set *isl_map_range(struct isl_map *map) if (!map) goto error; - if (isl_map_may_be_set(map)) + if (isl_map_is_set(map)) return (isl_set *)map; map = isl_map_cow(map); @@ -4328,11 +4374,19 @@ __isl_give isl_basic_map *isl_basic_map_from_domain( __isl_give isl_basic_map *isl_basic_map_from_range( __isl_take isl_basic_set *bset) { + isl_space *space; + space = isl_basic_set_get_space(bset); + space = isl_space_from_range(space); + bset = isl_basic_set_reset_space(bset, space); return (isl_basic_map *)bset; } struct isl_map *isl_map_from_range(struct isl_set *set) { + isl_space *space; + space = isl_set_get_space(set); + space = isl_space_from_range(space); + set = isl_set_reset_space(set, space); return (struct isl_map *)set; } diff --git a/isl_output.c b/isl_output.c index 57a15705..c8f833d0 100644 --- a/isl_output.c +++ b/isl_output.c @@ -417,7 +417,9 @@ static __isl_give isl_printer *print_space(__isl_keep isl_space *dim, { if (rational && !latex) p = isl_printer_print_str(p, "rat: "); - if (set) + if (isl_space_is_params(dim)) + ; + else if (isl_space_is_set(dim)) p = print_tuple(dim, p, isl_dim_set, 1, latex, eq); else { p = print_tuple(dim, p, isl_dim_in, 0, latex, eq); @@ -686,6 +688,20 @@ static __isl_give isl_printer *print_disjuncts(__isl_keep isl_map *map, return p; } +/* Print the disjuncts of a map (or set). + * If the map turns out to be a universal parameter domain, then + * we need to print the colon. Otherwise, the output looks identical + * to the empty set. + */ +static __isl_give isl_printer *print_disjuncts_map(__isl_keep isl_map *map, + __isl_take isl_printer *p, int set, int latex) +{ + if (isl_map_plain_is_universe(map) && isl_space_is_params(map->dim)) + return isl_printer_print_str(p, s_such_that[latex]); + else + return print_disjuncts(map, p, set, latex); +} + struct isl_aff_split { isl_basic_map *aff; isl_map *map; @@ -841,7 +857,7 @@ static __isl_give isl_printer *print_split_map(__isl_take isl_printer *p, if (i) p = isl_printer_print_str(p, "; "); p = print_space(dim, p, set, 0, rational, split[i].aff); - p = print_disjuncts(split[i].map, p, set, 0); + p = print_disjuncts_map(split[i].map, p, set, 0); } return p; @@ -861,7 +877,7 @@ static __isl_give isl_printer *isl_map_print_isl_body(__isl_keep isl_map *map, rational = map->n > 0 && ISL_F_ISSET(map->p[0], ISL_BASIC_MAP_RATIONAL); p = print_space(map->dim, p, set, 0, rational, NULL); - p = print_disjuncts(map, p, set, 0); + p = print_disjuncts_map(map, p, set, 0); } free_split(split, map->n); return p; @@ -889,7 +905,7 @@ static __isl_give isl_printer *print_latex_map(__isl_keep isl_map *map, } p = isl_printer_print_str(p, s_open_set[1]); p = print_space(map->dim, p, set, 1, 0, aff); - p = print_disjuncts(map, p, set, 1); + p = print_disjuncts_map(map, p, set, 1); p = isl_printer_print_str(p, s_close_set[1]); return p; @@ -1334,8 +1350,7 @@ static __isl_give isl_printer *print_qpolynomial_isl(__isl_take isl_printer *p, p = isl_printer_print_str(p, " -> "); } p = isl_printer_print_str(p, "{ "); - if (isl_space_dim(qp->dim, isl_dim_set) > 0 || - isl_space_is_named_or_nested(qp->dim, isl_dim_set)) { + if (!isl_space_is_params(qp->dim)) { p = print_space(qp->dim, p, 1, 0, 0, NULL); p = isl_printer_print_str(p, " -> "); } @@ -1449,8 +1464,7 @@ static __isl_give isl_printer *isl_pwqp_print_isl_body( for (i = 0; i < pwqp->n; ++i) { if (i) p = isl_printer_print_str(p, "; "); - if (isl_space_dim(pwqp->dim, isl_dim_set) > 0 || - isl_space_is_named_or_nested(pwqp->dim, isl_dim_set)) { + if (!isl_space_is_params(pwqp->dim)) { p = print_space(pwqp->p[i].set->dim, p, 1, 0, 0, NULL); p = isl_printer_print_str(p, " -> "); } @@ -1473,8 +1487,7 @@ static __isl_give isl_printer *print_pw_qpolynomial_isl( } p = isl_printer_print_str(p, "{ "); if (pwqp->n == 0) { - if (isl_space_dim(pwqp->dim, isl_dim_set) > 0 || - isl_space_is_named_or_nested(pwqp->dim, isl_dim_set)) { + if (!isl_space_is_params(pwqp->dim)) { p = print_space(pwqp->dim, p, 1, 0, 0, NULL); p = isl_printer_print_str(p, " -> "); } @@ -1511,8 +1524,7 @@ static __isl_give isl_printer *isl_pwf_print_isl_body( for (i = 0; i < pwf->n; ++i) { if (i) p = isl_printer_print_str(p, "; "); - if (isl_space_dim(pwf->dim, isl_dim_set) > 0 || - isl_space_is_named_or_nested(pwf->dim, isl_dim_set)) { + if (!isl_space_is_params(pwf->dim)) { p = print_space(pwf->p[i].set->dim, p, 1, 0, 0, NULL); p = isl_printer_print_str(p, " -> "); } @@ -1532,8 +1544,7 @@ static __isl_give isl_printer *print_pw_qpolynomial_fold_isl( } p = isl_printer_print_str(p, "{ "); if (pwf->n == 0) { - if (isl_space_dim(pwf->dim, isl_dim_set) > 0 || - isl_space_is_named_or_nested(pwf->dim, isl_dim_set)) { + if (!isl_space_is_params(pwf->dim)) { p = print_space(pwf->dim, p, 1, 0, 0, NULL); p = isl_printer_print_str(p, " -> "); } @@ -1946,9 +1957,10 @@ __isl_give isl_printer *isl_printer_print_space(__isl_take isl_printer *p, } p = isl_printer_print_str(p, "{ "); - p = print_tuple(dim, p, isl_dim_in, 0, 0, NULL); - p = isl_printer_print_str(p, " -> "); - p = print_tuple(dim, p, isl_dim_out, 0, 0, NULL); + if (isl_space_is_params(dim)) + p = isl_printer_print_str(p, s_such_that[0]); + else + p = print_space(dim, p, 0, 0, 0, NULL); p = isl_printer_print_str(p, " }"); return p; @@ -1972,9 +1984,7 @@ __isl_give isl_printer *isl_printer_print_local_space(__isl_take isl_printer *p, p = isl_printer_print_str(p, " -> "); } p = isl_printer_print_str(p, "{ "); - p = print_tuple(ls->dim, p, isl_dim_in, 0, 0, NULL); - p = isl_printer_print_str(p, " -> "); - p = print_tuple(ls->dim, p, isl_dim_out, 0, 0, NULL); + p = print_space(ls->dim, p, 0, 0, 0, NULL); n_div = isl_local_space_dim(ls, isl_dim_div); if (n_div > 0) { int i; @@ -1993,7 +2003,8 @@ __isl_give isl_printer *isl_printer_print_local_space(__isl_take isl_printer *p, p = isl_printer_print_isl_int(p, ls->div->row[i][0]); p = isl_printer_print_str(p, "]"); } - } + } else if (isl_space_is_params(ls->dim)) + p = isl_printer_print_str(p, s_such_that[0]); p = isl_printer_print_str(p, " }"); return p; error: @@ -2007,8 +2018,13 @@ static __isl_give isl_printer *print_aff(__isl_take isl_printer *p, unsigned total; total = isl_local_space_dim(aff->ls, isl_dim_all); - p = print_tuple(aff->ls->dim, p, isl_dim_set, 1, 0, NULL); - p = isl_printer_print_str(p, " -> ["); + if (isl_space_is_params(aff->ls->dim)) + ; + else { + p = print_tuple(aff->ls->dim, p, isl_dim_set, 1, 0, NULL); + p = isl_printer_print_str(p, " -> "); + } + p = isl_printer_print_str(p, "["); p = isl_printer_print_str(p, "("); p = print_affine_of_len(aff->ls->dim, aff->ls->div, p, aff->v->el + 1, 1 + total, 1); diff --git a/isl_space.c b/isl_space.c index 971c1113..d5f62ed9 100644 --- a/isl_space.c +++ b/isl_space.c @@ -48,10 +48,66 @@ __isl_give isl_space *isl_space_alloc(isl_ctx *ctx, return dim; } +/* Mark the space as being that of a set, by setting the domain tuple + * to isl_id_none. + */ +static __isl_give isl_space *mark_as_set(__isl_take isl_space *space) +{ + space = isl_space_cow(space); + if (!space) + return NULL; + space = isl_space_set_tuple_id(space, isl_dim_in, &isl_id_none); + return space; +} + +/* Is the space that of a set? + */ +int isl_space_is_set(__isl_keep isl_space *space) +{ + if (!space) + return -1; + if (space->n_in != 0 || space->nested[0]) + return 0; + if (space->tuple_id[0] != &isl_id_none) + return 0; + return 1; +} + __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx, unsigned nparam, unsigned dim) { - return isl_space_alloc(ctx, nparam, 0, dim); + isl_space *space; + space = isl_space_alloc(ctx, nparam, 0, dim); + space = mark_as_set(space); + return space; +} + +/* Mark the space as being that of a parameter domain, by setting + * both tuples to isl_id_none. + */ +static __isl_give isl_space *mark_as_params(isl_space *space) +{ + if (!space) + return NULL; + space = isl_space_set_tuple_id(space, isl_dim_in, &isl_id_none); + space = isl_space_set_tuple_id(space, isl_dim_out, &isl_id_none); + return space; +} + +/* Is the space that of a parameter domain? + */ +int isl_space_is_params(__isl_keep isl_space *space) +{ + if (!space) + return -1; + if (space->n_in != 0 || space->nested[0] || + space->n_out != 0 || space->nested[1]) + return 0; + if (space->tuple_id[0] != &isl_id_none) + return 0; + if (space->tuple_id[1] != &isl_id_none) + return 0; + return 1; } /* Create a space for a parameter domain. @@ -60,6 +116,7 @@ __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx, unsigned nparam) { isl_space *space; space = isl_space_alloc(ctx, nparam, 0, 0); + space = mark_as_params(space); return space; } @@ -307,6 +364,12 @@ int isl_space_has_tuple_id(__isl_keep isl_space *dim, enum isl_dim_type type) { if (!dim) return -1; + if (isl_space_is_params(dim)) + isl_die(dim->ctx, isl_error_invalid, + "parameter spaces don't have tuple ids", return -1); + if (isl_space_is_set(dim) && type != isl_dim_set) + isl_die(dim->ctx, isl_error_invalid, + "set spaces can only have a set id", return -1); if (type != isl_dim_in && type != isl_dim_out) isl_die(dim->ctx, isl_error_invalid, "only input, output and set tuples can have ids", @@ -317,13 +380,14 @@ int isl_space_has_tuple_id(__isl_keep isl_space *dim, enum isl_dim_type type) __isl_give isl_id *isl_space_get_tuple_id(__isl_keep isl_space *dim, enum isl_dim_type type) { + int has_id; + if (!dim) return NULL; - if (type != isl_dim_in && type != isl_dim_out) - isl_die(dim->ctx, isl_error_invalid, - "only input, output and set tuples can have ids", - return NULL); - if (!dim->tuple_id[type - isl_dim_in]) + has_id = isl_space_has_tuple_id(dim, type); + if (has_id < 0) + return NULL; + if (!has_id) isl_die(dim->ctx, isl_error_invalid, "tuple has no id", return NULL); return isl_id_copy(dim->tuple_id[type - isl_dim_in]); @@ -947,13 +1011,14 @@ error: __isl_give isl_space *isl_space_map_from_set(__isl_take isl_space *dim) { + isl_ctx *ctx; isl_id **ids = NULL; if (!dim) return NULL; - isl_assert(dim->ctx, dim->n_in == 0, goto error); - if (dim->n_out == 0 && !isl_space_is_named_or_nested(dim, isl_dim_out)) - return dim; + ctx = isl_space_get_ctx(dim); + if (!isl_space_is_set(dim)) + isl_die(ctx, isl_error_invalid, "not a set space", goto error); dim = isl_space_cow(dim); if (!dim) return NULL; @@ -1127,32 +1192,57 @@ __isl_give isl_space *isl_space_domain(__isl_take isl_space *dim) if (!dim) return NULL; dim = isl_space_drop_outputs(dim, 0, dim->n_out); - return isl_space_reverse(dim); + dim = isl_space_reverse(dim); + dim = mark_as_set(dim); + return dim; } __isl_give isl_space *isl_space_from_domain(__isl_take isl_space *dim) { - return isl_space_reverse(dim); + if (!dim) + return NULL; + if (!isl_space_is_set(dim)) + isl_die(isl_space_get_ctx(dim), isl_error_invalid, + "not a set space", goto error); + dim = isl_space_reverse(dim); + dim = isl_space_reset(dim, isl_dim_out); + return dim; +error: + isl_space_free(dim); + return NULL; } __isl_give isl_space *isl_space_range(__isl_take isl_space *dim) { if (!dim) return NULL; - return isl_space_drop_inputs(dim, 0, dim->n_in); + dim = isl_space_drop_inputs(dim, 0, dim->n_in); + dim = mark_as_set(dim); + return dim; } __isl_give isl_space *isl_space_from_range(__isl_take isl_space *dim) { - return dim; + if (!dim) + return NULL; + if (!isl_space_is_set(dim)) + isl_die(isl_space_get_ctx(dim), isl_error_invalid, + "not a set space", goto error); + return isl_space_reset(dim, isl_dim_in); +error: + isl_space_free(dim); + return NULL; } __isl_give isl_space *isl_space_params(__isl_take isl_space *space) { + if (isl_space_is_params(space)) + return space; space = isl_space_drop_dims(space, isl_dim_in, 0, isl_space_dim(space, isl_dim_in)); space = isl_space_drop_dims(space, isl_dim_out, 0, isl_space_dim(space, isl_dim_out)); + space = mark_as_params(space); return space; } @@ -1260,7 +1350,7 @@ int isl_space_is_wrapping(__isl_keep isl_space *dim) if (!dim) return -1; - if (dim->n_in != 0 || dim->tuple_id[0] || dim->nested[0]) + if (!isl_space_is_set(dim)) return 0; return dim->nested[1] != NULL; @@ -1328,6 +1418,8 @@ int isl_space_may_be_set(__isl_keep isl_space *dim) { if (!dim) return -1; + if (isl_space_is_set(dim)) + return 1; if (isl_space_dim(dim, isl_dim_in) != 0) return 0; if (isl_space_is_named_or_nested(dim, isl_dim_in)) -- 2.11.4.GIT