Home | History | Annotate | Download | only in GlobalsModRef
      1 ; RUN: opt < %s -disable-basicaa -globals-aa -dse -S | FileCheck %s
      2 
      3 @X = internal global i32 4
      4 
      5 define i32 @test0() {
      6 ; CHECK-LABEL: @test0
      7 ; CHECK: store i32 0, i32* @X
      8 ; CHECK-NEXT: call i32 @func_readonly() #0
      9 ; CHECK-NEXT: store i32 1, i32* @X
     10   store i32 0, i32* @X
     11   %x = call i32 @func_readonly() #0
     12   store i32 1, i32* @X
     13   ret i32 %x
     14 }
     15 
     16 define i32 @test1() {
     17 ; CHECK-LABEL: @test1
     18 ; CHECK-NOT: store
     19 ; CHECK: call i32 @func_read_argmem_only() #1
     20 ; CHECK-NEXT: store i32 3, i32* @X
     21   store i32 2, i32* @X
     22   %x = call i32 @func_read_argmem_only() #1
     23   store i32 3, i32* @X
     24   ret i32 %x
     25 }
     26 
     27 declare i32 @func_readonly() #0
     28 declare i32 @func_read_argmem_only() #1
     29 
     30 attributes #0 = { readonly nounwind }
     31 attributes #1 = { readonly argmemonly nounwind }
     32