[Mlir-commits] [mlir] 4e53df0 - [MLIR][Presburger] PresburgerSet::containsPoint: support disjuncts with locals

Arjun P llvmlistbot at llvm.org
Fri Jun 10 17:18:32 PDT 2022


Author: Arjun P
Date: 2022-06-10T20:18:49-04:00
New Revision: 4e53df0f0b57575d1707663467ba130a00420439

URL: https://github.com/llvm/llvm-project/commit/4e53df0f0b57575d1707663467ba130a00420439
DIFF: https://github.com/llvm/llvm-project/commit/4e53df0f0b57575d1707663467ba130a00420439.diff

LOG: [MLIR][Presburger] PresburgerSet::containsPoint: support disjuncts with locals

Reviewed By: Groverkss

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp b/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp
index d0c946fe6762d..9ce59d769d43c 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<int64_t> 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 f010dab10ebe1..ba3a0024f9732 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) {


        


More information about the Mlir-commits mailing list