[flang-commits] [flang] [flang][docs] add design doc for inline runtime checks (PR #228502)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Mon Oct 5 03:43:52 PDT 2026


https://github.com/tblah commented:

This is really good stuff. Thanks Jean.

My AI reviewer wonders if this will also need explicit handling when inlining elemental operations. For example,
```
n_checked = assert(ok, guard(n))
producer = elemental(shape(n_checked)) { body(i) }
consumer = elemental(other_shape)      { apply producer(j) }
```

Inlining replaces `apply producer(j)` with `body(j)`, then removes `producer`. If `n_checked` was used only by the producer’s shape, the cloned computation no longer depends on it. I think DCE still can't remove the assert because of the write effect on the new resource but I think there's now nothing to block the further re-ordering you describe.

Looking into this comment led me to notice that elemental inlining is currently blocked by any write effect without checking if the resources are disjoint. That may need attention too.



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


More information about the flang-commits mailing list