isl_dim_free(dst);
return NULL;
}
+
+/* Given a dimension specification "dim" of a set, create a dimension
+ * specification for the lift of the set. In particular, the result
+ * is of the form [dim -> local[..]], with n_local variables in the
+ * range of the wrapped map.
+ */
+__isl_give isl_dim *isl_dim_lift(__isl_take isl_dim *dim, unsigned n_local)
+{
+ isl_dim *local_dim;
+
+ if (!dim)
+ return NULL;
+
+ local_dim = isl_dim_dup(dim);
+ local_dim = isl_dim_drop(local_dim, isl_dim_set, 0, dim->n_out);
+ local_dim = isl_dim_add(local_dim, isl_dim_set, n_local);
+ local_dim = isl_dim_set_tuple_name(local_dim, isl_dim_set, "local");
+ dim = isl_dim_join(isl_dim_from_domain(dim),
+ isl_dim_from_range(local_dim));
+ dim = isl_dim_wrap(dim);
+ dim = isl_dim_set_tuple_name(dim, isl_dim_set, "lifted");
+
+ return dim;
+}
__isl_give isl_dim *isl_dim_replace(__isl_take isl_dim *dst,
enum isl_dim_type type, __isl_keep isl_dim *src);
+
+__isl_give isl_dim *isl_dim_lift(__isl_take isl_dim *dim, unsigned n_local);
if (!bset)
return NULL;
- if (bset->n_div == 0)
- return bset;
-
bset = isl_basic_set_cow(bset);
if (!bset)
return NULL;
dim = isl_basic_set_get_dim(bset);
- dim = isl_dim_add(dim, isl_dim_set, bset->n_div);
+ dim = isl_dim_lift(dim, bset->n_div);
if (!dim)
goto error;
isl_dim_free(bset->dim);
if (!set)
return NULL;
- if (set->n == 0 || set->p[0]->n_div == 0)
- return set;
set = isl_set_cow(set);
if (!set)
n_div = set->p[0]->n_div;
dim = isl_set_get_dim(set);
- dim = isl_dim_add(dim, isl_dim_set, n_div);
+ dim = isl_dim_lift(dim, n_div);
if (!dim)
goto error;
isl_dim_free(set->dim);