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