321 lines · plain
1; RUN: opt < %s -S -passes=speculative-execution \2; RUN: -spec-exec-max-speculation-cost 4 -spec-exec-max-not-hoisted 3 \3; RUN: | FileCheck %s4 5declare float @llvm.fabs.f32(float) nounwind readnone6declare i32 @llvm.ctlz.i32(i32, i1) nounwind readnone7 8declare float @unknown(float)9declare float @unknown_readnone(float) nounwind readnone10 11; CHECK-LABEL: @ifThen_fabs(12; CHECK: call float @llvm.fabs.f32(13; CHECK: br i1 true14define void @ifThen_fabs() {15 br i1 true, label %a, label %b16 17a:18 %x = call float @llvm.fabs.f32(float 1.0)19 br label %b20 21b:22 ret void23}24 25; CHECK-LABEL: @ifThen_ctlz(26; CHECK: call i32 @llvm.ctlz.i32(27; CHECK: br i1 true28define void @ifThen_ctlz() {29 br i1 true, label %a, label %b30 31a:32 %x = call i32 @llvm.ctlz.i32(i32 0, i1 true)33 br label %b34 35b:36 ret void37}38 39; CHECK-LABEL: @ifThen_call_sideeffects(40; CHECK: br i1 true41; CHECK: call float @unknown(42define void @ifThen_call_sideeffects() {43 br i1 true, label %a, label %b44 45a:46 %x = call float @unknown(float 1.0)47 br label %b48 49b:50 ret void51}52 53; CHECK-LABEL: @ifThen_call_readnone(54; CHECK: br i1 true55; CHECK: call float @unknown_readnone(56define void @ifThen_call_readnone() {57 br i1 true, label %a, label %b58a:59 %x = call float @unknown_readnone(float 1.0)60 br label %b61 62b:63 ret void64}65 66; CHECK-LABEL: @ifThen_fpclass(67; CHECK: %class = call i1 @llvm.is.fpclass.f32(float %x, i32 11)68; CHECK-NEXT: br i1 true69define void @ifThen_fpclass(float %x) {70 br i1 true, label %a, label %b71 72a:73 %class = call i1 @llvm.is.fpclass.f32(float %x, i32 11)74 br label %b75 76b:77 ret void78}79 80; CHECK-LABEL: @ifThen_arithmetic_fence(81; CHECK: %fence = call float @llvm.arithmetic.fence.f32(float %x)82; CHECK-NEXT: br i1 true83define void @ifThen_arithmetic_fence(float %x) {84 br i1 true, label %a, label %b85 86a:87 %fence = call float @llvm.arithmetic.fence.f32(float %x)88 br label %b89 90b:91 ret void92}93 94declare i1 @llvm.is.fpclass.f32(float, i32)95declare float @llvm.arithmetic.fence.f32(float)96 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 true100define void @ifThen_fptrunc_round(float %x) {101 br i1 true, label %a, label %b102 103a:104 %round = call half @llvm.fptrunc.round.f16.f32(float %x, metadata !"round.downward")105 br label %b106 107b:108 ret void109}110 111declare half @llvm.fptrunc.round.f16.f32(float, metadata)112 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 true116define void @ifThen_vector_reduce_fadd(float %x, <2 x float> %y) {117 br i1 true, label %a, label %b118 119a:120 %reduce = call float @llvm.vector.reduce.fadd.v2f32(float %x, <2 x float> %y)121 br label %b122 123b:124 ret void125}126 127declare float @llvm.vector.reduce.fadd.v2f32(float, <2 x float>)128 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 true132define void @ifThen_vector_reduce_fmul(float %x, <2 x float> %y) {133 br i1 true, label %a, label %b134 135a:136 %reduce = call float @llvm.vector.reduce.fmul.v2f32(float %x, <2 x float> %y)137 br label %b138 139b:140 ret void141}142 143declare float @llvm.vector.reduce.fmul.v2f32(float, <2 x float>)144 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 true148define void @ifThen_vector_reduce_add(<2 x i32> %x) {149 br i1 true, label %a, label %b150 151a:152 %reduce = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %x)153 br label %b154 155b:156 ret void157}158 159declare i32 @llvm.vector.reduce.add.v2i32(<2 x i32>)160 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 true164define void @ifThen_vector_reduce_mul(<2 x i32> %x) {165 br i1 true, label %a, label %b166 167a:168 %reduce = call i32 @llvm.vector.reduce.mul.v2i32(<2 x i32> %x)169 br label %b170 171b:172 ret void173}174 175declare i32 @llvm.vector.reduce.mul.v2i32(<2 x i32>)176 177 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 true181define void @ifThen_vector_reduce_and(<2 x i32> %x) {182 br i1 true, label %a, label %b183 184a:185 %reduce = call i32 @llvm.vector.reduce.and.v2i32(<2 x i32> %x)186 br label %b187 188b:189 ret void190}191 192declare i32 @llvm.vector.reduce.and.v2i32(<2 x i32>)193 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 true197define void @ifThen_vector_reduce_or(<2 x i32> %x) {198 br i1 true, label %a, label %b199 200a:201 %reduce = call i32 @llvm.vector.reduce.or.v2i32(<2 x i32> %x)202 br label %b203 204b:205 ret void206}207 208declare i32 @llvm.vector.reduce.or.v2i32(<2 x i32>)209 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 true213define void @ifThen_vector_reduce_xor(<2 x i32> %x) {214 br i1 true, label %a, label %b215 216a:217 %reduce = call i32 @llvm.vector.reduce.xor.v2i32(<2 x i32> %x)218 br label %b219 220b:221 ret void222}223 224declare i32 @llvm.vector.reduce.xor.v2i32(<2 x i32>)225 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 true229define void @ifThen_vector_reduce_smax(<2 x i32> %x) {230 br i1 true, label %a, label %b231 232a:233 %reduce = call i32 @llvm.vector.reduce.smax.v2i32(<2 x i32> %x)234 br label %b235 236b:237 ret void238}239 240declare i32 @llvm.vector.reduce.smax.v2i32(<2 x i32>)241 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 true245define void @ifThen_vector_reduce_umax(<2 x i32> %x) {246 br i1 true, label %a, label %b247 248a:249 %reduce = call i32 @llvm.vector.reduce.umax.v2i32(<2 x i32> %x)250 br label %b251 252b:253 ret void254}255 256declare i32 @llvm.vector.reduce.umax.v2i32(<2 x i32>)257 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 true261define void @ifThen_vector_reduce_umin(<2 x i32> %x) {262 br i1 true, label %a, label %b263 264a:265 %reduce = call i32 @llvm.vector.reduce.umin.v2i32(<2 x i32> %x)266 br label %b267 268b:269 ret void270}271 272declare i32 @llvm.vector.reduce.umin.v2i32(<2 x i32>)273 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 true277define void @ifThen_vector_reduce_fmax(<2 x float> %x) {278 br i1 true, label %a, label %b279 280a:281 %reduce = call float @llvm.vector.reduce.fmax.v2f32(<2 x float> %x)282 br label %b283 284b:285 ret void286}287 288declare float @llvm.vector.reduce.fmax.v2f32(<2 x float>)289 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 true293define void @ifThen_vector_reduce_fmin(<2 x float> %x) {294 br i1 true, label %a, label %b295 296a:297 %reduce = call float @llvm.vector.reduce.fmin.v2f32(<2 x float> %x)298 br label %b299 300b:301 ret void302}303 304declare float @llvm.vector.reduce.fmin.v2f32(<2 x float>)305 306; CHECK-LABEL: @ifThen_ldexp(307; CHECK: %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %y)308; CHECK-NEXT: br i1 true309define void @ifThen_ldexp(float %x, i32 %y) {310 br i1 true, label %a, label %b311 312a:313 %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %y)314 br label %b315 316b:317 ret void318}319 320declare float @llvm.ldexp.f32.i32(float, i32)321