diff --git a/mlir/lib/Analysis/AffineStructures.cpp b/mlir/lib/Analysis/AffineStructures.cpp --- a/mlir/lib/Analysis/AffineStructures.cpp +++ b/mlir/lib/Analysis/AffineStructures.cpp @@ -2005,6 +2005,9 @@ ineq[pos] = lower ? 1 : -1; // Dims and symbols. for (unsigned j = 0, e = map.getNumInputs(); j < e; j++) { + if (pos == positions[j]) + // Invalid bound: pos appears among the operands. + return failure(); ineq[positions[j]] = lower ? -flatExpr[j] : flatExpr[j]; } // Copy over the local id coefficients.