[Mlir-commits] [mlir] [mlir][SCF] Skip dynamic peeling for non-index loops (PR #217909)

Matthias Springer llvmlistbot at llvm.org
Sun Aug 23 02:17:52 PDT 2026


matthias-springer wrote:

Converting to `index` should be safe from a correctness point of view. See documentation of the `scf.for` op, there can be no overflow:
```
No-overflow condition: LB + n*Step must be representable in the type of the induction variable. Otherwise the behavior is undefined.
```

Whether to use `index_cast` or `index_castui` can be decided based on the `unsignedCmp` attribute.

I'm not sure if converting to `index` would be the right thing. Instead of `affine.apply`, multiple `arith` dialect ops could be used.

It's also totally fine to just restrict loop peeling to index-typed loops for now.


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


More information about the Mlir-commits mailing list