File: blockaddress.ll

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (125 lines) | stat: -rw-r--r-- 2,500 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
; RUN: llvm-as %s -o %t.bc
; RUN: llvm-link %t.bc -S | FileCheck %s

declare void @f(ptr)

; Test that a blockaddress in @y referring to %label in @x can be moved when @y
; appears after @x.
define void @x() {
  br label %label

label:
  call void @y()
  ret void
}

define void @y() {
; CHECK: define void @y() {
; CHECK-NEXT: call void @f(ptr blockaddress(@x, %label))
  call void @f(ptr blockaddress(@x, %label))
  ret void
}

; Test that a blockaddress in @a referring to %label in @b can be moved when @a
; appears before @b.
define void @a() {
; CHECK: define void @a() {
; CHECK-NEXT: call void @f(ptr blockaddress(@b, %label))
  call void @f(ptr blockaddress(@b, %label))
  ret void
}

define void @b() {
  br label %label

label:
  call void @a()
  ret void
}

; Test that @c and @d can both have blockaddress Constants that refer to one
; another.

define void @c() {
; CHECK: define void @c() {
; CHECK-NEXT:  br label %label
; CHECK-EMPTY:
; CHECK-NEXT: label:
; CHECK-NEXT: call void @f(ptr blockaddress(@d, %label))
  br label %label

label:
  call void @f(ptr blockaddress(@d, %label))
  ret void
}

define void @d() {
; CHECK: define void @d() {
; CHECK-NEXT:  br label %label
; CHECK-EMPTY:
; CHECK-NEXT: label:
; CHECK-NEXT: call void @f(ptr blockaddress(@c, %label))
  br label %label

label:
  call void @f(ptr blockaddress(@c, %label))
  ret void
}

; Test that Functions added to IRLinker's Worklist member lazily (linkonce_odr)
; aren't susceptible to the the same issues as @x/@y above.
define void @parsed() {
  br label %label

label:
  ret void
}

define linkonce_odr void @lazy() {
; CHECK: define linkonce_odr void @lazy() {
; CHECK-NEXT: br label %label
; CHECK-EMPTY:
; CHECK-NEXT: label:
; CHECK-NEXT: call void @f(ptr blockaddress(@parsed, %label))
  br label %label

label:
  call void @f(ptr blockaddress(@parsed, %label))
  ret void
}

define void @parsed2() {
  call void @lazy()
  ret void
}

; Same test as @lazy, just with one more level of lazy parsed functions.
define void @parsed3() {
  br label %label

label:
  ret void
}

define linkonce_odr void @lazy1() {
; CHECK: define linkonce_odr void @lazy1() {
; CHECK-NEXT: br label %label
; CHECK-EMPTY:
; CHECK-NEXT: label:
; CHECK-NEXT: call void @f(ptr blockaddress(@parsed3, %label))
  br label %label

label:
  call void @f(ptr blockaddress(@parsed3, %label))
  ret void
}

define linkonce_odr void @lazy2() {
  call void @lazy1()
  ret void
}

define void @parsed4() {
  call void @lazy2()
  ret void
}