• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -disable-basic-aa -globals-aa -dse -S | FileCheck %s
2
3@X = internal global i32 4
4
5define 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
16define 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
27declare i32 @func_readonly() #0
28declare i32 @func_read_argmem_only() #1
29
30attributes #0 = { readonly nounwind }
31attributes #1 = { readonly argmemonly nounwind }
32