Skip to content

Commit bca1177

Browse files
authored
[nfc][mlir][scf]: Define scf.for lower/upper bounds can be also negative or zero (#117534)
Per the discussion here: #116748 (comment) , this commit properly declare that lower and upper bounds can be also negative or zero.
1 parent 1901da3 commit bca1177

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

mlir/include/mlir/Dialect/SCF/IR/SCFOps.td

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,10 @@ def ForOp : SCF_Op<"for",
153153
operation defines an SSA value for its induction variable. It has one
154154
region capturing the loop body. The induction variable is represented as an
155155
argument of this region. This SSA value is a signless integer or index.
156-
The step is a value of same type but required to be positive. The lower and
157-
upper bounds specify a half-open range: the range includes the lower bound
158-
but does not include the upper bound.
156+
The step is a value of same type but required to be positive, the lower and
157+
upper bounds can be also negative or zero. The lower and upper bounds specify
158+
a half-open range: the iteration is executed iff the signed comparison of induction
159+
variable value is less than the upper bound and bigger or equal to the lower bound.
159160

160161
The body region must contain exactly one block that terminates with
161162
`scf.yield`. Calling ForOp::build will create such a region and insert

0 commit comments

Comments
 (0)