[Mlir-commits] [mlir] 7f61124 - [MLIR][Presburger] MultiAffineFunction::removeIdRange: fix bug where kind wasn't passed on to IntegerPolyhedron::removeIdRange

Arjun P llvmlistbot at llvm.org
Tue Mar 22 06:13:04 PDT 2022


Author: Arjun P
Date: 2022-03-22T13:13:11Z
New Revision: 7f6112496b9bb97648e1cee8e9059528e2f5b1a8

URL: https://github.com/llvm/llvm-project/commit/7f6112496b9bb97648e1cee8e9059528e2f5b1a8
DIFF: https://github.com/llvm/llvm-project/commit/7f6112496b9bb97648e1cee8e9059528e2f5b1a8.diff

LOG: [MLIR][Presburger] MultiAffineFunction::removeIdRange: fix bug where kind wasn't passed on to IntegerPolyhedron::removeIdRange

Reviewed By: Groverkss

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

Added: 
    

Modified: 
    mlir/lib/Analysis/Presburger/PWMAFunction.cpp
    mlir/unittests/Analysis/Presburger/PWMAFunctionTest.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Analysis/Presburger/PWMAFunction.cpp b/mlir/lib/Analysis/Presburger/PWMAFunction.cpp
index 77fc3c0f8c3d5..4ce7882ef5466 100644
--- a/mlir/lib/Analysis/Presburger/PWMAFunction.cpp
+++ b/mlir/lib/Analysis/Presburger/PWMAFunction.cpp
@@ -99,7 +99,7 @@ void MultiAffineFunction::swapId(unsigned posA, unsigned posB) {
 void MultiAffineFunction::removeIdRange(IdKind kind, unsigned idStart,
                                         unsigned idLimit) {
   output.removeColumns(idStart + getIdKindOffset(kind), idLimit - idStart);
-  IntegerPolyhedron::removeIdRange(idStart, idLimit);
+  IntegerPolyhedron::removeIdRange(kind, idStart, idLimit);
 }
 
 void MultiAffineFunction::eliminateRedundantLocalId(unsigned posA,

diff  --git a/mlir/unittests/Analysis/Presburger/PWMAFunctionTest.cpp b/mlir/unittests/Analysis/Presburger/PWMAFunctionTest.cpp
index b8469a8c0174a..9ee2fdc0cae6d 100644
--- a/mlir/unittests/Analysis/Presburger/PWMAFunctionTest.cpp
+++ b/mlir/unittests/Analysis/Presburger/PWMAFunctionTest.cpp
@@ -140,3 +140,21 @@ TEST(PWMAFunction, valueAt) {
   EXPECT_THAT(*nonNegPWAF.valueAt({2, -3}), ElementsAre(-1, -1));
   EXPECT_FALSE(nonNegPWAF.valueAt({-2, -3}).hasValue());
 }
+
+TEST(PWMAFunction, removeIdRangeRegressionTest) {
+  PWMAFunction pwafA = parsePWMAF(
+      /*numInputs=*/2, /*numOutputs=*/1,
+      {
+          {"(x, y) : (x == 0, y == 0, x - 2*(x floordiv 2) == 0, y - 2*(y "
+           "floordiv 2) == 0)",
+           {{0, 0, 0, 0, 0}}} // (0, 0)
+      });
+  PWMAFunction pwafB = parsePWMAF(
+      /*numInputs=*/2, /*numOutputs=*/1,
+      {
+          {"(x, y) : (x - 11*y == 0, 11*x - y == 0, x - 2*(x floordiv 2) == 0, "
+           "y - 2*(y floordiv 2) == 0)",
+           {{0, 0, 0, 0, 0}}} // (0, 0)
+      });
+  EXPECT_TRUE(pwafA.isEqual(pwafB));
+}


        


More information about the Mlir-commits mailing list