1 ; RUN: llvm-as %s -o %t.bc
2 ; RUN: llvm-link %t.bc -S | FileCheck %s
6 ; Test that a blockaddress in @y referring to %label in @x can be moved when @y
17 ; CHECK: define void @y() {
18 ; CHECK-NEXT: call void @f(ptr blockaddress(@x, %label))
19 call void @f(ptr blockaddress(@x, %label))
23 ; Test that a blockaddress in @a referring to %label in @b can be moved when @a
26 ; CHECK: define void @a() {
27 ; CHECK-NEXT: call void @f(ptr blockaddress(@b, %label))
28 call void @f(ptr blockaddress(@b, %label))
40 ; Test that @c and @d can both have blockaddress Constants that refer to one
44 ; CHECK: define void @c() {
45 ; CHECK-NEXT: br label %label
48 ; CHECK-NEXT: call void @f(ptr blockaddress(@d, %label))
52 call void @f(ptr blockaddress(@d, %label))
57 ; CHECK: define void @d() {
58 ; CHECK-NEXT: br label %label
61 ; CHECK-NEXT: call void @f(ptr blockaddress(@c, %label))
65 call void @f(ptr blockaddress(@c, %label))
69 ; Test that Functions added to IRLinker's Worklist member lazily (linkonce_odr)
70 ; aren't susceptible to the the same issues as @x/@y above.
71 define void @parsed() {
78 define linkonce_odr void @lazy() {
79 ; CHECK: define linkonce_odr void @lazy() {
80 ; CHECK-NEXT: br label %label
83 ; CHECK-NEXT: call void @f(ptr blockaddress(@parsed, %label))
87 call void @f(ptr blockaddress(@parsed, %label))
91 define void @parsed2() {
96 ; Same test as @lazy, just with one more level of lazy parsed functions.
97 define void @parsed3() {
104 define linkonce_odr void @lazy1() {
105 ; CHECK: define linkonce_odr void @lazy1() {
106 ; CHECK-NEXT: br label %label
109 ; CHECK-NEXT: call void @f(ptr blockaddress(@parsed3, %label))
113 call void @f(ptr blockaddress(@parsed3, %label))
117 define linkonce_odr void @lazy2() {
122 define void @parsed4() {