• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -basicaa -functionattrs -S | FileCheck %s
2
3; CHECK: define i32 @leaf() #0
4define i32 @leaf() {
5  ret i32 1
6}
7
8; CHECK: define i32 @self_rec() #1
9define i32 @self_rec() {
10  %a = call i32 @self_rec()
11  ret i32 4
12}
13
14; CHECK: define i32 @indirect_rec() #1
15define i32 @indirect_rec() {
16  %a = call i32 @indirect_rec2()
17  ret i32 %a
18}
19; CHECK: define i32 @indirect_rec2() #1
20define i32 @indirect_rec2() {
21  %a = call i32 @indirect_rec()
22  ret i32 %a
23}
24
25; CHECK: define i32 @extern() #1
26define i32 @extern() {
27  %a = call i32 @k()
28  ret i32 %a
29}
30declare i32 @k() readnone
31
32; CHECK: define internal i32 @called_by_norecurse() #0
33define internal i32 @called_by_norecurse() {
34  %a = call i32 @k()
35  ret i32 %a
36}
37define void @m() norecurse {
38  %a = call i32 @called_by_norecurse()
39  ret void
40}
41
42; CHECK: define internal i32 @called_by_norecurse_indirectly() #0
43define internal i32 @called_by_norecurse_indirectly() {
44  %a = call i32 @k()
45  ret i32 %a
46}
47define internal void @o() {
48  %a = call i32 @called_by_norecurse_indirectly()
49  ret void
50}
51define void @p() norecurse {
52  call void @o()
53  ret void
54}
55
56; CHECK: attributes #0 = { norecurse readnone }
57; CHECK: attributes #1 = { readnone }
58