[clang] Reland "[clang] Add nuw attribute to GEPs (#105496)" (PR #107257)

Sam Clegg via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 18 14:30:09 PST 2024


sbc100 wrote:

I used `wasm-reduce` on the `.ll` file and it looks like you were correct.  The result was:

```
target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20"
target triple = "wasm32-unknown-emscripten"                                         
                                                                                    
define void @_ZN6Magnum5Trade12GltfImporter6doMeshEjj(ptr %agg.tmp4.i.i.i.i.i) personality ptr null {
entry:                                                                           
  %0 = load i64, ptr inttoptr (i32 -16 to ptr), align 4                          
  store i64 %0, ptr %agg.tmp4.i.i.i.i.i, align 8                                 
  ret void                                                                       
}                                                                                
                                                                                 
; uselistorder directives                                                        
uselistorder ptr null, { 1, 2, 0 }  
```

It looks like there is a -16 to ptr cast in there.  I've ask the reported to try running with `-fsanitize=undefined` and `-fsanitize=address`.  Do you think those will catch this kind of thing?

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


More information about the cfe-commits mailing list