1; RUN: llvm-as < %s | llvm-dis | FileCheck %s
2; RUN: verify-uselistorder < %s
3; PR9857
4
5define void @f(i8** nocapture %ptr1) {
6; CHECK: define void @f
7entry:
8  br label %here.i
9
10here.i:
11  store i8* blockaddress(@doit, %here), i8** %ptr1, align 8
12; CHECK: blockaddress(@doit, %here)
13  br label %doit.exit
14
15doit.exit:
16  ret void
17}
18
19define void @doit(i8** nocapture %pptr) {
20; CHECK: define void @doit
21entry:
22  br label %here
23
24here:
25  store i8* blockaddress(@doit, %here), i8** %pptr, align 8
26; CHECK: blockaddress(@doit, %here)
27  br label %end
28
29end:
30  ret void
31}
32
33; PR13895
34define void @doitagain(i8** nocapture %pptr) {
35; CHECK: define void @doitagain
36entry:
37  br label %here
38
39here:
40  store i8* blockaddress(@doit, %here), i8** %pptr, align 8
41; CHECK: blockaddress(@doit, %here)
42  br label %end
43
44end:
45  ret void
46}
47
48; Check a blockaddress taken in two separate functions before the referenced
49; function.
50define i8* @take1() {
51  ret i8* blockaddress(@taken, %bb)
52}
53define i8* @take2() {
54  ret i8* blockaddress(@taken, %bb)
55}
56define void @taken() {
57  unreachable
58bb:
59  unreachable
60}
61