[Mlir-commits] [mlir] [mlir][scf] Fix `for-loop-peeling` crash (PR #77697)
Matthias Springer
llvmlistbot at llvm.org
Thu Jan 11 03:36:11 PST 2024
================
@@ -123,8 +123,9 @@ static LogicalResult peelForLoop(RewriterBase &b, ForOp forOp,
auto ubInt = getConstantIntValue(forOp.getUpperBound());
auto stepInt = getConstantIntValue(forOp.getStep());
- // No specialization necessary if step size is 1.
- if (getConstantIntValue(forOp.getStep()) == static_cast<int64_t>(1))
+ // No specialization necessary if step size is 1. Also bail out in case of an
+ // invalid zero or negative step which might have happened during folding.
+ if (stepInt && *stepInt <= 1)
----------------
matthias-springer wrote:
Interesting, I thought that negative step sizes were allowed, but the documentations says otherwise: `The step is a value of same type but required to be positive. `
https://github.com/llvm/llvm-project/pull/77697
More information about the Mlir-commits
mailing list