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

purnima shrivastava llvmlistbot at llvm.org
Sat Aug 22 08:35:10 PDT 2026


purnima-nlp wrote:

> Hi @purnima-nlp, thanks for your first contribution! :D
> 
> Please don't forget to reply to [this comment](https://github.com/llvm/llvm-project/pull/217909#issuecomment-5373078085). You may also take this opportunity to familiarize yourself with the _LLVM Policies_.
> 
> @zxt5 said in #216631: "the operands are not converted to index before the operation is created". Is there a reason why this isn't feasible, just curious?

Hello, thanks for asking. I do not think converting the operands to `index` is fundamentally infeasible: the pass could `arith.index_cast` the lower bound, upper bound, and step before creating `affine.apply`, then cast the computed split bound back.

I chose to be conservative “decline peeling” fix for this case because I was not sure that those casts preserve all integer-loop semantics across possible `index` bit widths and overflow cases. This also keeps the existing all-constant integer fast path unchanged.

If supporting dynamic non-`index` loops through casts is the preferred behavior, I will try to revise the next commit.


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


More information about the Mlir-commits mailing list