__isl_give isl_basic_set *isl_aff_nonneg_basic_set(__isl_take isl_aff *aff)
{
isl_constraint *ineq;
+ isl_basic_set *bset;
ineq = isl_inequality_from_aff(aff);
- return isl_basic_set_from_constraint(ineq);
+ bset = isl_basic_set_from_constraint(ineq);
+ bset = isl_basic_set_simplify(bset);
+ return bset;
}
/* Return a basic set containing those elements in the space
__isl_give isl_basic_set *isl_aff_zero_basic_set(__isl_take isl_aff *aff)
{
isl_constraint *ineq;
+ isl_basic_set *bset;
ineq = isl_equality_from_aff(aff);
- return isl_basic_set_from_constraint(ineq);
+ bset = isl_basic_set_from_constraint(ineq);
+ bset = isl_basic_set_simplify(bset);
+ return bset;
}
/* Return a basic set containing those elements in the shared space
}
/* Return a set containing those elements in the domain
- * of pwaff where it is zero.
+ * of pwaff where it is zero (if complement is 0) or not zero
+ * (if complement is 1).
*/
-__isl_give isl_set *isl_pw_aff_zero_set(__isl_take isl_pw_aff *pwaff)
+static __isl_give isl_set *pw_aff_zero_set(__isl_take isl_pw_aff *pwaff,
+ int complement)
{
int i;
isl_set *set;
for (i = 0; i < pwaff->n; ++i) {
isl_basic_set *bset;
- isl_set *set_i;
+ isl_set *set_i, *zero;
bset = isl_aff_zero_basic_set(isl_aff_copy(pwaff->p[i].aff));
- set_i = isl_set_from_basic_set(bset);
- set_i = isl_set_intersect(set_i, isl_set_copy(pwaff->p[i].set));
+ zero = isl_set_from_basic_set(bset);
+ set_i = isl_set_copy(pwaff->p[i].set);
+ if (complement)
+ set_i = isl_set_subtract(set_i, zero);
+ else
+ set_i = isl_set_intersect(set_i, zero);
set = isl_set_union_disjoint(set, set_i);
}
}
/* Return a set containing those elements in the domain
+ * of pwaff where it is zero.
+ */
+__isl_give isl_set *isl_pw_aff_zero_set(__isl_take isl_pw_aff *pwaff)
+{
+ return pw_aff_zero_set(pwaff, 0);
+}
+
+/* Return a set containing those elements in the domain
* of pwaff where it is not zero.
*/
__isl_give isl_set *isl_pw_aff_non_zero_set(__isl_take isl_pw_aff *pwaff)
{
- return isl_set_complement(isl_pw_aff_zero_set(pwaff));
+ return pw_aff_zero_set(pwaff, 1);
}
/* Return a set containing those elements in the shared domain
maff->space = isl_space_drop_dims(maff->space, type, first, n);
if (!maff->space)
return isl_multi_aff_free(maff);
+
+ if (type == isl_dim_out) {
+ for (i = 0; i < n; ++i)
+ isl_aff_free(maff->p[first + i]);
+ for (i = first; i + n < maff->n; ++i)
+ maff->p[i] = maff->p[i + n];
+ maff->n -= n;
+ return maff;
+ }
+
for (i = 0; i < maff->n; ++i) {
maff->p[i] = isl_aff_drop_dims(maff->p[i], type, first, n);
if (!maff->p[i])