[llvm] [DA] Check monotonicity for subscripts (PR #154527)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 25 02:09:19 PDT 2025


kasuga-fj wrote:

> I was wondering that isnt checking only geps for wrapping (i.e. nusw) sufficient ?

It's insufficient. This is insufficient. Please refer to relevant test cases, such as https://github.com/llvm/llvm-project/blob/296163f85dfc6a7f85972f5385ff85e67738a956/llvm/test/Analysis/DependenceAnalysis/DADelin.ll. For example, in `@t1`, `%arrayidx` is computed as `getelementptr inbounds i32, ptr %A, i32 %add11`. But `%add11` is delienealized into multiple subscripts, effectively something like `%A[i][j][k]`. DA assumes monotonicity for all subscripts, but `nusw` only guarantees the no-wrap for `%add11 * 4` and its addition to `%A`.

> Also, is MinMax calculator really needed?

Yes, it is necessary to validate the delinearization result. Please note that this PR aims to address the broader issue that "DA doesn't account for wrapping accesses", not just the specific case I gave in #149501.

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


More information about the llvm-commits mailing list