Skip to content

Commit 7f61124

Browse files
committed
[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
1 parent 93ccd7c commit 7f61124

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

mlir/lib/Analysis/Presburger/PWMAFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void MultiAffineFunction::swapId(unsigned posA, unsigned posB) {
9999
void MultiAffineFunction::removeIdRange(IdKind kind, unsigned idStart,
100100
unsigned idLimit) {
101101
output.removeColumns(idStart + getIdKindOffset(kind), idLimit - idStart);
102-
IntegerPolyhedron::removeIdRange(idStart, idLimit);
102+
IntegerPolyhedron::removeIdRange(kind, idStart, idLimit);
103103
}
104104

105105
void MultiAffineFunction::eliminateRedundantLocalId(unsigned posA,

mlir/unittests/Analysis/Presburger/PWMAFunctionTest.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,21 @@ TEST(PWMAFunction, valueAt) {
140140
EXPECT_THAT(*nonNegPWAF.valueAt({2, -3}), ElementsAre(-1, -1));
141141
EXPECT_FALSE(nonNegPWAF.valueAt({-2, -3}).hasValue());
142142
}
143+
144+
TEST(PWMAFunction, removeIdRangeRegressionTest) {
145+
PWMAFunction pwafA = parsePWMAF(
146+
/*numInputs=*/2, /*numOutputs=*/1,
147+
{
148+
{"(x, y) : (x == 0, y == 0, x - 2*(x floordiv 2) == 0, y - 2*(y "
149+
"floordiv 2) == 0)",
150+
{{0, 0, 0, 0, 0}}} // (0, 0)
151+
});
152+
PWMAFunction pwafB = parsePWMAF(
153+
/*numInputs=*/2, /*numOutputs=*/1,
154+
{
155+
{"(x, y) : (x - 11*y == 0, 11*x - y == 0, x - 2*(x floordiv 2) == 0, "
156+
"y - 2*(y floordiv 2) == 0)",
157+
{{0, 0, 0, 0, 0}}} // (0, 0)
158+
});
159+
EXPECT_TRUE(pwafA.isEqual(pwafB));
160+
}

0 commit comments

Comments
 (0)