[llvm] [DA] Add tests for nsw doesn't hold on entier iteration (PR #162281)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 21 13:15:24 PST 2025


kasuga-fj wrote:

> Also Note that `a1 * N1` and `a2 * N2` are two multiplications performed in DA code. If we cannot prove they do not overflow DA cannot be correct.

This assumption seems almost equivalent to requiring monotonicity over the entire domain. If we cannot prove monotonicity over the entire domain, then in most cases we cannot prove `a1 * N1` and `a2 * N2` don't overflow either. To go further, it feels like we can prove the former much more often than the latter. I'm really not sure why you are strongly opposed to introduce the notion like entire monotonicity.

I believe Symbolic RDIV should be rewritten to just compare the minimum/maximum values of the two subscripts, after ensuring they are monotonic over the entire domain. This approach is more natural and doesn’t require any complicated proofs.

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


More information about the llvm-commits mailing list