[llvm] [SCEV] Handle backedge-count logic for std::reverse like loops (PR #92560)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 10:41:24 PDT 2024


efriedma-quic wrote:

If the strides are equal, you end up dividing by zero.  But in that case, the actual backedge-taken count must be 0 (because otherwise it would wrap).  So you can actually fix that case by just using `umax(s1-s2, 1)` as the denominator

Whether it's worth supporting arbitrary strides... I guess we might as well?  I mean, if we're only support nowrap cases anyway, it's not really that much harder to reason about.  We'd probably need to add back the checks if we ever try to support no-nowrap cases, though.

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


More information about the llvm-commits mailing list