1 ; RUN: opt < %s -S -passes=speculative-execution \
2 ; RUN: -spec-exec-max-speculation-cost 4 -spec-exec-max-not-hoisted 3 \
5 declare float @llvm.fabs.f32(float) nounwind readnone
6 declare i32 @llvm.ctlz.i32(i32, i1) nounwind readnone
8 declare float @unknown(float)
9 declare float @unknown_readnone(float) nounwind readnone
11 ; CHECK-LABEL: @ifThen_fabs(
12 ; CHECK: call float @llvm.fabs.f32(
14 define void @ifThen_fabs() {
15 br i1 true, label %a, label %b
18 %x = call float @llvm.fabs.f32(float 1.0)
25 ; CHECK-LABEL: @ifThen_ctlz(
26 ; CHECK: call i32 @llvm.ctlz.i32(
28 define void @ifThen_ctlz() {
29 br i1 true, label %a, label %b
32 %x = call i32 @llvm.ctlz.i32(i32 0, i1 true)
39 ; CHECK-LABEL: @ifThen_call_sideeffects(
41 ; CHECK: call float @unknown(
42 define void @ifThen_call_sideeffects() {
43 br i1 true, label %a, label %b
46 %x = call float @unknown(float 1.0)
53 ; CHECK-LABEL: @ifThen_call_readnone(
55 ; CHECK: call float @unknown_readnone(
56 define void @ifThen_call_readnone() {
57 br i1 true, label %a, label %b
59 %x = call float @unknown_readnone(float 1.0)
66 ; CHECK-LABEL: @ifThen_fpclass(
67 ; CHECK: %class = call i1 @llvm.is.fpclass.f32(float %x, i32 11)
68 ; CHECK-NEXT: br i1 true
69 define void @ifThen_fpclass(float %x) {
70 br i1 true, label %a, label %b
73 %class = call i1 @llvm.is.fpclass.f32(float %x, i32 11)
80 ; CHECK-LABEL: @ifThen_arithmetic_fence(
81 ; CHECK: %fence = call float @llvm.arithmetic.fence.f32(float %x)
82 ; CHECK-NEXT: br i1 true
83 define void @ifThen_arithmetic_fence(float %x) {
84 br i1 true, label %a, label %b
87 %fence = call float @llvm.arithmetic.fence.f32(float %x)
94 declare i1 @llvm.is.fpclass.f32(float, i32)
95 declare float @llvm.arithmetic.fence.f32(float)
97 ; CHECK-LABEL: @ifThen_fptrunc_round(
98 ; CHECK: %round = call half @llvm.fptrunc.round.f16.f32(float %x, metadata !"round.downward")
99 ; CHECK-NEXT: br i1 true
100 define void @ifThen_fptrunc_round(float %x) {
101 br i1 true, label %a, label %b
104 %round = call half @llvm.fptrunc.round.f16.f32(float %x, metadata !"round.downward")
111 declare half @llvm.fptrunc.round.f16.f32(float, metadata)
113 ; CHECK-LABEL: @ifThen_vector_reduce_fadd(
114 ; CHECK: %reduce = call float @llvm.vector.reduce.fadd.v2f32(float %x, <2 x float> %y)
115 ; CHECK-NEXT: br i1 true
116 define void @ifThen_vector_reduce_fadd(float %x, <2 x float> %y) {
117 br i1 true, label %a, label %b
120 %reduce = call float @llvm.vector.reduce.fadd.v2f32(float %x, <2 x float> %y)
127 declare float @llvm.vector.reduce.fadd.v2f32(float, <2 x float>)
129 ; CHECK-LABEL: @ifThen_vector_reduce_fmul(
130 ; CHECK: %reduce = call float @llvm.vector.reduce.fmul.v2f32(float %x, <2 x float> %y)
131 ; CHECK-NEXT: br i1 true
132 define void @ifThen_vector_reduce_fmul(float %x, <2 x float> %y) {
133 br i1 true, label %a, label %b
136 %reduce = call float @llvm.vector.reduce.fmul.v2f32(float %x, <2 x float> %y)
143 declare float @llvm.vector.reduce.fmul.v2f32(float, <2 x float>)
145 ; CHECK-LABEL: @ifThen_vector_reduce_add(
146 ; CHECK: %reduce = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %x)
147 ; CHECK-NEXT: br i1 true
148 define void @ifThen_vector_reduce_add(<2 x i32> %x) {
149 br i1 true, label %a, label %b
152 %reduce = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %x)
159 declare i32 @llvm.vector.reduce.add.v2i32(<2 x i32>)
161 ; CHECK-LABEL: @ifThen_vector_reduce_mul(
162 ; CHECK: %reduce = call i32 @llvm.vector.reduce.mul.v2i32(<2 x i32> %x)
163 ; CHECK-NEXT: br i1 true
164 define void @ifThen_vector_reduce_mul(<2 x i32> %x) {
165 br i1 true, label %a, label %b
168 %reduce = call i32 @llvm.vector.reduce.mul.v2i32(<2 x i32> %x)
175 declare i32 @llvm.vector.reduce.mul.v2i32(<2 x i32>)
178 ; CHECK-LABEL: @ifThen_vector_reduce_and(
179 ; CHECK: %reduce = call i32 @llvm.vector.reduce.and.v2i32(<2 x i32> %x)
180 ; CHECK-NEXT: br i1 true
181 define void @ifThen_vector_reduce_and(<2 x i32> %x) {
182 br i1 true, label %a, label %b
185 %reduce = call i32 @llvm.vector.reduce.and.v2i32(<2 x i32> %x)
192 declare i32 @llvm.vector.reduce.and.v2i32(<2 x i32>)
194 ; CHECK-LABEL: @ifThen_vector_reduce_or(
195 ; CHECK: %reduce = call i32 @llvm.vector.reduce.or.v2i32(<2 x i32> %x)
196 ; CHECK-NEXT: br i1 true
197 define void @ifThen_vector_reduce_or(<2 x i32> %x) {
198 br i1 true, label %a, label %b
201 %reduce = call i32 @llvm.vector.reduce.or.v2i32(<2 x i32> %x)
208 declare i32 @llvm.vector.reduce.or.v2i32(<2 x i32>)
210 ; CHECK-LABEL: @ifThen_vector_reduce_xor(
211 ; CHECK: %reduce = call i32 @llvm.vector.reduce.xor.v2i32(<2 x i32> %x)
212 ; CHECK-NEXT: br i1 true
213 define void @ifThen_vector_reduce_xor(<2 x i32> %x) {
214 br i1 true, label %a, label %b
217 %reduce = call i32 @llvm.vector.reduce.xor.v2i32(<2 x i32> %x)
224 declare i32 @llvm.vector.reduce.xor.v2i32(<2 x i32>)
226 ; CHECK-LABEL: @ifThen_vector_reduce_smax(
227 ; CHECK: %reduce = call i32 @llvm.vector.reduce.smax.v2i32(<2 x i32> %x)
228 ; CHECK-NEXT: br i1 true
229 define void @ifThen_vector_reduce_smax(<2 x i32> %x) {
230 br i1 true, label %a, label %b
233 %reduce = call i32 @llvm.vector.reduce.smax.v2i32(<2 x i32> %x)
240 declare i32 @llvm.vector.reduce.smax.v2i32(<2 x i32>)
242 ; CHECK-LABEL: @ifThen_vector_reduce_umax(
243 ; CHECK: %reduce = call i32 @llvm.vector.reduce.umax.v2i32(<2 x i32> %x)
244 ; CHECK-NEXT: br i1 true
245 define void @ifThen_vector_reduce_umax(<2 x i32> %x) {
246 br i1 true, label %a, label %b
249 %reduce = call i32 @llvm.vector.reduce.umax.v2i32(<2 x i32> %x)
256 declare i32 @llvm.vector.reduce.umax.v2i32(<2 x i32>)
258 ; CHECK-LABEL: @ifThen_vector_reduce_umin(
259 ; CHECK: %reduce = call i32 @llvm.vector.reduce.umin.v2i32(<2 x i32> %x)
260 ; CHECK-NEXT: br i1 true
261 define void @ifThen_vector_reduce_umin(<2 x i32> %x) {
262 br i1 true, label %a, label %b
265 %reduce = call i32 @llvm.vector.reduce.umin.v2i32(<2 x i32> %x)
272 declare i32 @llvm.vector.reduce.umin.v2i32(<2 x i32>)
274 ; CHECK-LABEL: @ifThen_vector_reduce_fmax(
275 ; CHECK: %reduce = call float @llvm.vector.reduce.fmax.v2f32(<2 x float> %x)
276 ; CHECK-NEXT: br i1 true
277 define void @ifThen_vector_reduce_fmax(<2 x float> %x) {
278 br i1 true, label %a, label %b
281 %reduce = call float @llvm.vector.reduce.fmax.v2f32(<2 x float> %x)
288 declare float @llvm.vector.reduce.fmax.v2f32(<2 x float>)
290 ; CHECK-LABEL: @ifThen_vector_reduce_fmin(
291 ; CHECK: %reduce = call float @llvm.vector.reduce.fmin.v2f32(<2 x float> %x)
292 ; CHECK-NEXT: br i1 true
293 define void @ifThen_vector_reduce_fmin(<2 x float> %x) {
294 br i1 true, label %a, label %b
297 %reduce = call float @llvm.vector.reduce.fmin.v2f32(<2 x float> %x)
304 declare float @llvm.vector.reduce.fmin.v2f32(<2 x float>)
306 ; CHECK-LABEL: @ifThen_ldexp(
307 ; CHECK: %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %y)
308 ; CHECK-NEXT: br i1 true
309 define void @ifThen_ldexp(float %x, i32 %y) {
310 br i1 true, label %a, label %b
313 %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %y)
320 declare float @llvm.ldexp.f32.i32(float, i32)