1 ; RUN: opt < %s -aa-pipeline=basic-aa -passes='cgscc(function-attrs),rpo-function-attrs' -S | FileCheck %s
3 ; CHECK: Function Attrs
4 ; CHECK-SAME: norecurse nosync nounwind readnone
5 ; CHECK-NEXT: define i32 @leaf()
10 ; CHECK: Function Attrs
11 ; CHECK-NOT: norecurse
12 ; CHECK-SAME: readnone
13 ; CHECK-NOT: norecurse
14 ; CHECK-NEXT: define i32 @self_rec()
15 define i32 @self_rec() {
16 %a = call i32 @self_rec()
20 ; CHECK: Function Attrs
21 ; CHECK-NOT: norecurse
22 ; CHECK-SAME: readnone
23 ; CHECK-NOT: norecurse
24 ; CHECK-NEXT: define i32 @indirect_rec()
25 define i32 @indirect_rec() {
26 %a = call i32 @indirect_rec2()
29 ; CHECK: Function Attrs
30 ; CHECK-NOT: norecurse
31 ; CHECK-SAME: readnone
32 ; CHECK-NOT: norecurse
33 ; CHECK-NEXT: define i32 @indirect_rec2()
34 define i32 @indirect_rec2() {
35 %a = call i32 @indirect_rec()
39 ; CHECK: Function Attrs
40 ; CHECK-NOT: norecurse
41 ; CHECK-SAME: readnone
42 ; CHECK-NOT: norecurse
43 ; CHECK-NEXT: define i32 @extern()
44 define i32 @extern() {
49 ; CHECK: Function Attrs
50 ; CHECK-NEXT: declare i32 @k()
51 declare i32 @k() readnone
53 ; CHECK: Function Attrs
54 ; CHECK-NOT: norecurse
55 ; CHECK-SAME: nounwind
56 ; CHECK-NOT: norecurse
57 ; CHECK-NEXT: define void @intrinsic(ptr nocapture writeonly %dest, ptr nocapture readonly %src, i32 %len)
58 define void @intrinsic(ptr %dest, ptr %src, i32 %len) {
59 call void @llvm.memcpy.p0.p0.i32(ptr %dest, ptr %src, i32 %len, i1 false)
63 ; CHECK: Function Attrs
64 ; CHECK-NEXT: declare void @llvm.memcpy.p0.p0.i32
65 declare void @llvm.memcpy.p0.p0.i32(ptr, ptr, i32, i1)
67 ; CHECK: Function Attrs
68 ; CHECK-SAME: norecurse nosync readnone
69 ; CHECK-NEXT: define internal i32 @called_by_norecurse()
70 define internal i32 @called_by_norecurse() {
74 ; CHECK: Function Attrs
75 ; CHECK-NEXT: define void @m()
76 define void @m() norecurse {
77 %a = call i32 @called_by_norecurse()
81 ; CHECK: Function Attrs
82 ; CHECK-SAME: norecurse nosync readnone
83 ; CHECK-NEXT: define internal i32 @called_by_norecurse_indirectly()
84 define internal i32 @called_by_norecurse_indirectly() {
88 ; CHECK: Function Attrs
89 ; CHECK-NEXT: define internal void @o
90 define internal void @o() {
91 %a = call i32 @called_by_norecurse_indirectly()
94 ; CHECK: Function Attrs
95 ; CHECK-NEXT: define void @p
96 define void @p() norecurse {
101 ; CHECK: Function Attrs
102 ; CHECK-NOT: norecurse
103 ; CHECK-SAME: nosync readnone
104 ; CHECK-NOT: norecurse
105 ; CHECK-NEXT: define internal i32 @escapes_as_parameter
106 define internal i32 @escapes_as_parameter(ptr %p) {
110 ; CHECK: Function Attrs
111 ; CHECK-NEXT: define internal void @q
112 define internal void @q() {
113 %a = call i32 @escapes_as_parameter(ptr @escapes_as_parameter)
116 ; CHECK: Function Attrs
117 ; CHECK-NEXT: define void @r
118 define void @r() norecurse {