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