[MLIR] PresburgerSet subtraction: add documentation and assertion saying we don't support divisions yet

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D100324
This commit is contained in:
Arjun P 2021-04-12 20:38:27 +05:30
parent ac955452ab
commit eff067440e
2 changed files with 9 additions and 2 deletions

View File

@ -67,14 +67,17 @@ public:
void print(raw_ostream &os) const;
void dump() const;
/// Return the complement of this set.
/// Return the complement of this set. Computing the complement of a set
/// containing divisions is not yet supported.
PresburgerSet complement() const;
/// Return the set difference of this set and the given set, i.e.,
/// return `this \ set`.
/// return `this \ set`. Subtracting when either set contains divisions is not
/// yet supported.
PresburgerSet subtract(const PresburgerSet &set) const;
/// Return true if this set is equal to the given set, and false otherwise.
/// Checking equality when either set contains divisions is not yet supported.
bool isEqual(const PresburgerSet &set) const;
/// Return a universe set of the specified type that contains all points.

View File

@ -170,6 +170,8 @@ static void subtractRecursively(FlatAffineConstraints &b, Simplex &simplex,
return;
}
const FlatAffineConstraints &sI = s.getFlatAffineConstraints(i);
assert(sI.getNumLocalIds() == 0 &&
"Subtracting sets with divisions is not yet supported!");
unsigned initialSnapshot = simplex.getSnapshot();
unsigned offset = simplex.numConstraints();
simplex.intersectFlatAffineConstraints(sI);
@ -254,6 +256,8 @@ static void subtractRecursively(FlatAffineConstraints &b, Simplex &simplex,
PresburgerSet PresburgerSet::getSetDifference(FlatAffineConstraints fac,
const PresburgerSet &set) {
assertDimensionsCompatible(fac, set);
assert(fac.getNumLocalIds() == 0 &&
"Subtracting sets with divisions is not yet supported!");
if (fac.isEmptyByGCDTest())
return PresburgerSet::getEmptySet(fac.getNumDimIds(),
fac.getNumSymbolIds());