[mlir][affine] addLowerOrUpperBound: Disallow pos among boundOperands

Bounds such as `dim_{pos} <= c_1 * dim_x + ...` where `x == pos` are invalid. `addLowerOrUpperBound` previously added an incorrect inequality to the set. Such cases are now explicitly rejected.

Differential Revision: https://reviews.llvm.org/D107220
This commit is contained in:
Matthias Springer 2021-08-03 11:18:03 +09:00
parent 3a41ff4883
commit fef4708472
1 changed files with 4 additions and 0 deletions

View File

@ -2004,6 +2004,10 @@ FlatAffineConstraints::addLowerOrUpperBound(unsigned pos, AffineMap boundMap,
}
for (const auto &flatExpr : flatExprs) {
// Invalid bound: pos appears among the operands.
if (llvm::find(positions, pos) != positions.end())
continue;
SmallVector<int64_t, 4> ineq(getNumCols(), 0);
ineq[pos] = lower ? 1 : -1;
// Dims and symbols.