[llvm] [DA] Check monotonicity for subscripts (PR #154527)
    Sushant Gokhale via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Aug 25 09:57:31 PDT 2025
    
    
  
sushgokh wrote:
> > I was wondering that isnt checking only geps for wrapping (i.e. nusw) sufficient ?
> 
> It's 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`.
> 
Lets suppose that `nusw` on `%add11` does not guarantee `nusw` on individual subscripts. But then you should be able to get back `%add11` using combination of wrapped/unwrapped subscripts. This is definitely not possible because 
`(anything + UB)=UB != %add11`.
Do you agree here ?
https://github.com/llvm/llvm-project/pull/154527
    
    
More information about the llvm-commits
mailing list