• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc %s -o -
2
3;; Reference to a label that gets deleted.
4define i8* @test1() nounwind {
5entry:
6	ret i8* blockaddress(@test1b, %test_label)
7}
8
9define i32 @test1b() nounwind {
10entry:
11	ret i32 -1
12test_label:
13	br label %ret
14ret:
15	ret i32 -1
16}
17
18
19;; Issues with referring to a label that gets RAUW'd later.
20define i32 @test2a() nounwind {
21entry:
22        %target = bitcast i8* blockaddress(@test2b, %test_label) to i8*
23
24        call i32 @test2b(i8* %target)
25
26        ret i32 0
27}
28
29define i32 @test2b(i8* %target) nounwind {
30entry:
31        indirectbr i8* %target, [label %test_label]
32
33test_label:
34; assume some code here...
35        br label %ret
36
37ret:
38        ret i32 -1
39}
40
41; Issues with a BB that gets RAUW'd to another one after references are
42; generated.
43define void @test3(i8** %P, i8** %Q) nounwind {
44entry:
45  store i8* blockaddress(@test3b, %test_label), i8** %P
46  store i8* blockaddress(@test3b, %ret), i8** %Q
47  ret void
48}
49
50define i32 @test3b() nounwind {
51entry:
52	br label %test_label
53test_label:
54	br label %ret
55ret:
56	ret i32 -1
57}
58
59
60; PR6673
61
62define i64 @test4a() {
63	%target = bitcast i8* blockaddress(@test4b, %usermain) to i8*
64	%ret = call i64 @test4b(i8* %target)
65
66	ret i64 %ret
67}
68
69define i64 @test4b(i8* %Code) {
70entry:
71	indirectbr i8* %Code, [label %usermain]
72usermain:
73	br label %label_line_0
74
75label_line_0:
76	br label %label_line_1
77
78label_line_1:
79	%target = ptrtoint i8* blockaddress(@test4b, %label_line_0) to i64
80	ret i64 %target
81}
82