deopt-bundles.ll
4.71 KB
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
; RUN: opt -S -always-inline < %s | FileCheck %s
declare void @f()
declare i32 @g()
declare fastcc i32 @g.fastcc()
define i32 @callee_0() alwaysinline {
entry:
call void @f()
ret i32 2
}
define i32 @caller_0() {
; CHECK-LABEL: @caller_0(
entry:
; CHECK: entry:
; CHECK-NEXT: call void @f()
; CHECK-NEXT: ret i32 2
%x = call i32 @callee_0() [ "deopt"(i32 5) ]
ret i32 %x
}
define i32 @callee_1() alwaysinline {
entry:
call void @f() [ "deopt"() ]
call void @f() [ "deopt"(i32 0, i32 1) ]
call void @f() [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ]
ret i32 2
}
define i32 @caller_1() {
; CHECK-LABEL: @caller_1(
entry:
; CHECK: entry:
; CHECK-NEXT: call void @f() [ "deopt"(i32 5) ]
; CHECK-NEXT: call void @f() [ "deopt"(i32 5, i32 0, i32 1) ]
; CHECK-NEXT: call void @f() [ "deopt"(i32 5, i32 0, i32 1), "foo"(double 0.000000e+00) ]
; CHECK-NEXT: ret i32 2
%x = call i32 @callee_1() [ "deopt"(i32 5) ]
ret i32 %x
}
define i32 @callee_2() alwaysinline {
entry:
%v = call i32 @g() [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ]
ret i32 %v
}
define i32 @caller_2(i32 %val) {
; CHECK-LABEL: @caller_2(
entry:
; CHECK: entry:
; CHECK-NEXT: [[RVAL:%[^ ]+]] = call i32 @g() [ "deopt"(i32 %val, i32 0, i32 1), "foo"(double 0.000000e+00) ]
; CHECK-NEXT: ret i32 [[RVAL]]
%x = call i32 @callee_2() [ "deopt"(i32 %val) ]
ret i32 %x
}
define i32 @callee_3() alwaysinline {
entry:
%v = call i32 @g() [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ]
ret i32 %v
}
define i32 @caller_3() personality i8 3 {
; CHECK-LABEL: @caller_3(
entry:
%x = invoke i32 @callee_3() [ "deopt"(i32 7) ] to label %normal unwind label %unwind
; CHECK: invoke i32 @g() [ "deopt"(i32 7, i32 0, i32 1), "foo"(double 0.000000e+00) ]
normal:
ret i32 %x
unwind:
%cleanup = landingpad i8 cleanup
ret i32 101
}
define i32 @callee_4() alwaysinline personality i8 3 {
entry:
%v = invoke i32 @g() [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ] to label %normal unwind label %unwind
normal:
ret i32 %v
unwind:
%cleanup = landingpad i8 cleanup
ret i32 100
}
define i32 @caller_4() {
; CHECK-LABEL: @caller_4(
entry:
; CHECK: invoke i32 @g() [ "deopt"(i32 7, i32 0, i32 1), "foo"(double 0.000000e+00) ]
%x = call i32 @callee_4() [ "deopt"(i32 7) ]
ret i32 %x
}
define i32 @callee_5() alwaysinline personality i8 3 {
entry:
%v = invoke fastcc i32 @g.fastcc() #0 [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ] to label %normal unwind label %unwind
normal:
ret i32 %v
unwind:
%cleanup = landingpad i8 cleanup
ret i32 100
}
define i32 @caller_5() {
; CHECK-LABEL: @caller_5(
entry:
; CHECK: invoke fastcc i32 @g.fastcc() #[[FOO_BAR_ATTR_IDX:[0-9]+]] [ "deopt"(i32 7, i32 0, i32 1), "foo"(double 0.000000e+00) ]
%x = call i32 @callee_5() [ "deopt"(i32 7) ]
ret i32 %x
}
define i32 @callee_6() alwaysinline personality i8 3 {
entry:
%v = call fastcc i32 @g.fastcc() #0 [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ]
ret i32 %v
}
define i32 @caller_6() {
; CHECK-LABEL: @caller_6(
entry:
; CHECK: call fastcc i32 @g.fastcc() #[[FOO_BAR_ATTR_IDX]] [ "deopt"(i32 7, i32 0, i32 1), "foo"(double 0.000000e+00) ]
%x = call i32 @callee_6() [ "deopt"(i32 7) ]
ret i32 %x
}
define i32 @callee_7(i1 %val) alwaysinline personality i8 3 {
; We want something that PruningFunctionCloner is not smart enough to
; recognize, but can be recognized by recursivelySimplifyInstruction.
entry:
br i1 %val, label %check, label %precheck
precheck:
br label %check
check:
%p = phi i1 [ %val, %entry ], [ true, %precheck ]
br i1 %p, label %do.not, label %do
do.not:
ret i32 0
do:
%v = call fastcc i32 @g.fastcc() [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ]
ret i32 %v
}
define i32 @caller_7() {
; CHECK-LABEL: @caller_7(
entry:
; CHECK-NOT: call fastcc i32 @g.fastcc()
; CHECK: ret i32 0
%x = call i32 @callee_7(i1 true) [ "deopt"(i32 7) ]
ret i32 %x
}
define i32 @callee_8(i1 %val) alwaysinline personality i8 3 {
; We want something that PruningFunctionCloner is not smart enough to
; recognize, but can be recognized by recursivelySimplifyInstruction.
entry:
br i1 %val, label %check, label %precheck
precheck:
br label %check
check:
%p = phi i1 [ %val, %entry ], [ true, %precheck ]
br i1 %p, label %do.not, label %do
do.not:
ret i32 0
do:
%phi = phi i32 [ 0, %check ], [ %v, %do ]
%v = call fastcc i32 @g.fastcc() [ "deopt"(i32 0, i32 1), "foo"(double 0.0) ]
%ic = icmp eq i32 %v, 42
br i1 %ic, label %do, label %done
done:
ret i32 %phi
}
define i32 @caller_8() {
; CHECK-LABEL: @caller_8(
entry:
; CHECK-NOT: call fastcc i32 @g.fastcc()
; CHECK: ret i32 0
%x = call i32 @callee_8(i1 true) [ "deopt"(i32 7) ]
ret i32 %x
}
attributes #0 = { "foo"="bar" }
; CHECK: attributes #[[FOO_BAR_ATTR_IDX]] = { "foo"="bar" }