[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
This commit is contained in:
Arjun P 2022-03-21 17:13:19 +00:00
parent 93ccd7c490
commit 7f6112496b
2 changed files with 19 additions and 1 deletions

View File

@ -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,

View File

@ -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));
}