[Mlir-commits] [mlir] [MLIR][Presburger] Fix simplify() of IntegerRelation (PR #181469)

Arjun Pitchanathan llvmlistbot at llvm.org
Thu Feb 19 11:50:39 PST 2026


superty wrote:

Okay, I think there's at least one bug that gets fixed by the change from 0 to `firstVar`.  Namely, if the equalities matrix is all zero in some column, then `findEqualityWithNonZeroAfterRow` would return nothing for that column, and that column will never be eliminated from the inequalities. So then the inequalities matrix can have non-zero elements in this column. Now when we go to some later columns and eliminate those, the non-zero column of the inequalities matrix gets skipped. The equality we are adding will still be zero, so the addition can be skipped, but the scaling by `rowMultiplier` cannot be skipped.

```cpp
    DynamicAPInt v = pivotMultiplier * constraints->atEq(pivotRow, j) +
                     rowMultiplier * at(rowIdx, j);
```

https://github.com/llvm/llvm-project/pull/181469


More information about the Mlir-commits mailing list