From: Arjun P Date: Fri, 10 Jun 2022 01:53:46 +0000 (-0400) Subject: [MLIR][Presburger] PresburgerSet::containsPoint: support disjuncts with locals X-Git-Tag: upstream/15.0.7~5130 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e53df0f0b57575d1707663467ba130a00420439;p=platform%2Fupstream%2Fllvm.git [MLIR][Presburger] PresburgerSet::containsPoint: support disjuncts with locals Reviewed By: Groverkss Differential Revision: https://reviews.llvm.org/D127466 --- diff --git a/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp b/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp index d0c946f..9ce59d7 100644 --- a/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp +++ b/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp @@ -63,7 +63,7 @@ PresburgerRelation::unionSet(const PresburgerRelation &set) const { /// A point is contained in the union iff any of the parts contain the point. bool PresburgerRelation::containsPoint(ArrayRef point) const { return llvm::any_of(disjuncts, [&](const IntegerRelation &disjunct) { - return (disjunct.containsPoint(point)); + return (disjunct.containsPointNoLocal(point)); }); } diff --git a/mlir/unittests/Analysis/Presburger/PresburgerSetTest.cpp b/mlir/unittests/Analysis/Presburger/PresburgerSetTest.cpp index f010dab..ba3a002 100644 --- a/mlir/unittests/Analysis/Presburger/PresburgerSetTest.cpp +++ b/mlir/unittests/Analysis/Presburger/PresburgerSetTest.cpp @@ -124,6 +124,10 @@ TEST(SetTest, containsPoint) { EXPECT_FALSE(setB.containsPoint({x, y})); } } + + // The PresburgerSet has only one id, x, so we supply one value. + EXPECT_TRUE(PresburgerSet(parsePoly("(x) : (x - 2*(x floordiv 2) == 0)")) + .containsPoint({0})); } TEST(SetTest, Union) {