[MLIR][Presburger] PresburgerSet::containsPoint: support disjuncts with locals
authorArjun P <arjunpitchanathan@gmail.com>
Fri, 10 Jun 2022 01:53:46 +0000 (21:53 -0400)
committerArjun P <arjunpitchanathan@gmail.com>
Sat, 11 Jun 2022 00:18:49 +0000 (20:18 -0400)
Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D127466

mlir/lib/Analysis/Presburger/PresburgerRelation.cpp
mlir/unittests/Analysis/Presburger/PresburgerSetTest.cpp

index d0c946f..9ce59d7 100644 (file)
@@ -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<int64_t> point) const {
   return llvm::any_of(disjuncts, [&](const IntegerRelation &disjunct) {
-    return (disjunct.containsPoint(point));
+    return (disjunct.containsPointNoLocal(point));
   });
 }
 
index f010dab..ba3a002 100644 (file)
@@ -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) {