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 %s 4 5declare float @llvm.fabs.f32(float) nounwind readnone 6declare i32 @llvm.ctlz.i32(i32, i1) nounwind readnone 7 8declare float @unknown(float) 9declare float @unknown_readnone(float) nounwind readnone 10 11; CHECK-LABEL: @ifThen_fabs( 12; CHECK: call float @llvm.fabs.f32( 13; CHECK: br i1 true 14define void @ifThen_fabs() { 15 br i1 true, label %a, label %b 16 17a: 18 %x = call float @llvm.fabs.f32(float 1.0) 19 br label %b 20 21b: 22 ret void 23} 24 25; CHECK-LABEL: @ifThen_ctlz( 26; CHECK: call i32 @llvm.ctlz.i32( 27; CHECK: br i1 true 28define void @ifThen_ctlz() { 29 br i1 true, label %a, label %b 30 31a: 32 %x = call i32 @llvm.ctlz.i32(i32 0, i1 true) 33 br label %b 34 35b: 36 ret void 37} 38 39; CHECK-LABEL: @ifThen_call_sideeffects( 40; CHECK: br i1 true 41; CHECK: call float @unknown( 42define void @ifThen_call_sideeffects() { 43 br i1 true, label %a, label %b 44 45a: 46 %x = call float @unknown(float 1.0) 47 br label %b 48 49b: 50 ret void 51} 52 53; CHECK-LABEL: @ifThen_call_readnone( 54; CHECK: br i1 true 55; CHECK: call float @unknown_readnone( 56define void @ifThen_call_readnone() { 57 br i1 true, label %a, label %b 58a: 59 %x = call float @unknown_readnone(float 1.0) 60 br label %b 61 62b: 63 ret void 64} 65 66; CHECK-LABEL: @ifThen_fpclass( 67; CHECK: %class = call i1 @llvm.is.fpclass.f32(float %x, i32 11) 68; CHECK-NEXT: br i1 true 69define void @ifThen_fpclass(float %x) { 70 br i1 true, label %a, label %b 71 72a: 73 %class = call i1 @llvm.is.fpclass.f32(float %x, i32 11) 74 br label %b 75 76b: 77 ret void 78} 79 80; CHECK-LABEL: @ifThen_arithmetic_fence( 81; CHECK: %fence = call float @llvm.arithmetic.fence.f32(float %x) 82; CHECK-NEXT: br i1 true 83define void @ifThen_arithmetic_fence(float %x) { 84 br i1 true, label %a, label %b 85 86a: 87 %fence = call float @llvm.arithmetic.fence.f32(float %x) 88 br label %b 89 90b: 91 ret void 92} 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 true 100define void @ifThen_fptrunc_round(float %x) { 101 br i1 true, label %a, label %b 102 103a: 104 %round = call half @llvm.fptrunc.round.f16.f32(float %x, metadata !"round.downward") 105 br label %b 106 107b: 108 ret void 109} 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 true 116define void @ifThen_vector_reduce_fadd(float %x, <2 x float> %y) { 117 br i1 true, label %a, label %b 118 119a: 120 %reduce = call float @llvm.vector.reduce.fadd.v2f32(float %x, <2 x float> %y) 121 br label %b 122 123b: 124 ret void 125} 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 true 132define void @ifThen_vector_reduce_fmul(float %x, <2 x float> %y) { 133 br i1 true, label %a, label %b 134 135a: 136 %reduce = call float @llvm.vector.reduce.fmul.v2f32(float %x, <2 x float> %y) 137 br label %b 138 139b: 140 ret void 141} 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 true 148define void @ifThen_vector_reduce_add(<2 x i32> %x) { 149 br i1 true, label %a, label %b 150 151a: 152 %reduce = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %x) 153 br label %b 154 155b: 156 ret void 157} 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 true 164define void @ifThen_vector_reduce_mul(<2 x i32> %x) { 165 br i1 true, label %a, label %b 166 167a: 168 %reduce = call i32 @llvm.vector.reduce.mul.v2i32(<2 x i32> %x) 169 br label %b 170 171b: 172 ret void 173} 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 true 181define void @ifThen_vector_reduce_and(<2 x i32> %x) { 182 br i1 true, label %a, label %b 183 184a: 185 %reduce = call i32 @llvm.vector.reduce.and.v2i32(<2 x i32> %x) 186 br label %b 187 188b: 189 ret void 190} 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 true 197define void @ifThen_vector_reduce_or(<2 x i32> %x) { 198 br i1 true, label %a, label %b 199 200a: 201 %reduce = call i32 @llvm.vector.reduce.or.v2i32(<2 x i32> %x) 202 br label %b 203 204b: 205 ret void 206} 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 true 213define void @ifThen_vector_reduce_xor(<2 x i32> %x) { 214 br i1 true, label %a, label %b 215 216a: 217 %reduce = call i32 @llvm.vector.reduce.xor.v2i32(<2 x i32> %x) 218 br label %b 219 220b: 221 ret void 222} 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 true 229define void @ifThen_vector_reduce_smax(<2 x i32> %x) { 230 br i1 true, label %a, label %b 231 232a: 233 %reduce = call i32 @llvm.vector.reduce.smax.v2i32(<2 x i32> %x) 234 br label %b 235 236b: 237 ret void 238} 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 true 245define void @ifThen_vector_reduce_umax(<2 x i32> %x) { 246 br i1 true, label %a, label %b 247 248a: 249 %reduce = call i32 @llvm.vector.reduce.umax.v2i32(<2 x i32> %x) 250 br label %b 251 252b: 253 ret void 254} 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 true 261define void @ifThen_vector_reduce_umin(<2 x i32> %x) { 262 br i1 true, label %a, label %b 263 264a: 265 %reduce = call i32 @llvm.vector.reduce.umin.v2i32(<2 x i32> %x) 266 br label %b 267 268b: 269 ret void 270} 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 true 277define void @ifThen_vector_reduce_fmax(<2 x float> %x) { 278 br i1 true, label %a, label %b 279 280a: 281 %reduce = call float @llvm.vector.reduce.fmax.v2f32(<2 x float> %x) 282 br label %b 283 284b: 285 ret void 286} 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 true 293define void @ifThen_vector_reduce_fmin(<2 x float> %x) { 294 br i1 true, label %a, label %b 295 296a: 297 %reduce = call float @llvm.vector.reduce.fmin.v2f32(<2 x float> %x) 298 br label %b 299 300b: 301 ret void 302} 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 true 309define void @ifThen_ldexp(float %x, i32 %y) { 310 br i1 true, label %a, label %b 311 312a: 313 %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %y) 314 br label %b 315 316b: 317 ret void 318} 319 320declare float @llvm.ldexp.f32.i32(float, i32) 321