forked from OSchip/llvm-project
[MLIR][Presburger] getDivRepr: fix bug where dividend was negated
Also updated the tests, which were asserting the wrong behaviour. Reviewed By: Groverkss Differential Revision: https://reviews.llvm.org/D128735
This commit is contained in:
parent
25f46084d8
commit
e9fa18637d
|
@ -172,9 +172,9 @@ static LogicalResult getDivRepr(const IntegerRelation &cst, unsigned pos,
|
|||
expr.resize(cst.getNumCols(), 0);
|
||||
for (unsigned i = 0, e = cst.getNumIds(); i < e; ++i)
|
||||
if (i != pos)
|
||||
expr[i] = signDiv * cst.atEq(eqInd, i);
|
||||
expr[i] = -signDiv * cst.atEq(eqInd, i);
|
||||
|
||||
expr.back() = signDiv * cst.atEq(eqInd, cst.getNumCols() - 1);
|
||||
expr.back() = -signDiv * cst.atEq(eqInd, cst.getNumCols() - 1);
|
||||
normalizeDivisionByGCD(expr, divisor);
|
||||
|
||||
return success();
|
||||
|
|
|
@ -725,7 +725,7 @@ TEST(IntegerPolyhedronTest, computeLocalReprFromEquality) {
|
|||
// Convert `q` to a local variable.
|
||||
poly.convertToLocal(IdKind::SetDim, 2, 3);
|
||||
|
||||
std::vector<SmallVector<int64_t, 8>> divisions = {{-1, -1, 0, 0}};
|
||||
std::vector<SmallVector<int64_t, 8>> divisions = {{1, 1, 0, 0}};
|
||||
SmallVector<unsigned, 8> denoms = {4};
|
||||
|
||||
checkDivisionRepresentation(poly, divisions, denoms);
|
||||
|
@ -735,7 +735,7 @@ TEST(IntegerPolyhedronTest, computeLocalReprFromEquality) {
|
|||
// Convert `q` to a local variable.
|
||||
poly.convertToLocal(IdKind::SetDim, 2, 3);
|
||||
|
||||
std::vector<SmallVector<int64_t, 8>> divisions = {{-1, -1, 0, 0}};
|
||||
std::vector<SmallVector<int64_t, 8>> divisions = {{1, 1, 0, 0}};
|
||||
SmallVector<unsigned, 8> denoms = {4};
|
||||
|
||||
checkDivisionRepresentation(poly, divisions, denoms);
|
||||
|
@ -745,7 +745,7 @@ TEST(IntegerPolyhedronTest, computeLocalReprFromEquality) {
|
|||
// Convert `q` to a local variable.
|
||||
poly.convertToLocal(IdKind::SetDim, 2, 3);
|
||||
|
||||
std::vector<SmallVector<int64_t, 8>> divisions = {{1, 1, 0, -2}};
|
||||
std::vector<SmallVector<int64_t, 8>> divisions = {{-1, -1, 0, 2}};
|
||||
SmallVector<unsigned, 8> denoms = {3};
|
||||
|
||||
checkDivisionRepresentation(poly, divisions, denoms);
|
||||
|
@ -761,7 +761,7 @@ TEST(IntegerPolyhedronTest, computeLocalReprFromEqualityAndInequality) {
|
|||
poly.convertToLocal(IdKind::SetDim, 2, 4);
|
||||
|
||||
std::vector<SmallVector<int64_t, 8>> divisions = {{1, 1, 0, 0, 1},
|
||||
{-1, -1, 0, 0, 0}};
|
||||
{1, 1, 0, 0, 0}};
|
||||
SmallVector<unsigned, 8> denoms = {4, 3};
|
||||
|
||||
checkDivisionRepresentation(poly, divisions, denoms);
|
||||
|
|
Loading…
Reference in New Issue