[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 7 14:27:17 PST 2025
kasuga-fj wrote:
> All dependence testing, motonicity proof, etc. are only relevant when the loop is executed. If the guard condition is not satisfied the loop is not executed. for those values of `i` and `j` even if your results is incorrect it doesn't matter.
It looks to me that you are conflating "what dependence testing functions assume" with "when the result should be correct". It would be true that it’s sufficient for the result to be correct only when it is actually executed, but I’m talking about the preconditions which the testing functions rely on. For example, as for an addrec `{c,+,a}` (`a*i + c`), many testing functions assume that it takes its maximum value at the last iteration (`i = BTC`) if `a` is non-negative. This assumption holds when the addrec is monotonic over the entire iteration space. However, as the example I gave shows, this is not necessarily the case when some loop guards exist.
https://github.com/llvm/llvm-project/pull/162281
More information about the llvm-commits
mailing list