1; RUN: opt < %s -functionattrs         -S | FileCheck %s
2; RUN: opt < %s -passes=function-attrs -S | FileCheck %s
3
4; CHECK: define void @nouses-argworn-funrn(i32* nocapture readnone %.aaa) #0 {
5define void @nouses-argworn-funrn(i32* writeonly %.aaa) {
6nouses-argworn-funrn_entry:
7  ret void
8}
9
10; CHECK: define void @nouses-argworn-funro(i32* nocapture readnone %.aaa, i32* nocapture readonly %.bbb) #1 {
11define void @nouses-argworn-funro(i32* writeonly %.aaa, i32* %.bbb) {
12nouses-argworn-funro_entry:
13  %val = load i32 , i32* %.bbb
14  ret void
15}
16
17%_type_of_d-ccc = type <{ i8*, i8, i8, i8, i8 }>
18
19@d-ccc = internal global %_type_of_d-ccc <{ i8* null, i8 1, i8 13, i8 0, i8 -127 }>, align 8
20
21; CHECK: define void @nouses-argworn-funwo(i32* nocapture readnone %.aaa) #2 {
22define void @nouses-argworn-funwo(i32* writeonly %.aaa) {
23nouses-argworn-funwo_entry:
24  store i8 0, i8* getelementptr inbounds (%_type_of_d-ccc, %_type_of_d-ccc* @d-ccc, i32 0, i32 3)
25  ret void
26}
27
28; CHECK: attributes #0 = { {{.*}} readnone }
29; CHECK: attributes #1 = { {{.*}} readonly }
30; CHECK: attributes #2 = { {{.*}} writeonly }
31