1; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s 2 3; REQUIRES: asserts 4 5; CHECK: %[[#bool:]] = OpTypeBool 6; CHECK: %[[#true:]] = OpConstantTrue %[[#bool]] 7; CHECK: OpBranchConditional %[[#true]] 8 9%structtype = type { i32, i32, i8 addrspace(4)* } 10%structtype.0 = type <{ i32, i32, i8 addrspace(4)* }> 11 12@__block_literal_global = internal addrspace(1) constant %structtype { i32 16, i32 8, i8 addrspace(4)* addrspacecast (i8* null to i8 addrspace(4)*) }, align 8 13@__block_literal_global.1 = internal addrspace(1) constant %structtype { i32 16, i32 8, i8 addrspace(4)* addrspacecast (i8* null to i8 addrspace(4)*) }, align 8 14@__block_literal_global.2 = internal addrspace(1) constant %structtype { i32 16, i32 8, i8 addrspace(4)* addrspacecast (i8* null to i8 addrspace(4)*) }, align 8 15 16define spir_kernel void @block_typedef_mltpl_stmnt(i32 addrspace(1)* %res) { 17entry: 18 %0 = call spir_func <3 x i64> @BuiltInGlobalInvocationId() 19 %call = extractelement <3 x i64> %0, i32 0 20 %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %res, i64 %call 21 store i32 -1, i32 addrspace(1)* %arrayidx, align 4 22 %1 = bitcast %structtype addrspace(1)* @__block_literal_global to i8 addrspace(1)* 23 %2 = addrspacecast i8 addrspace(1)* %1 to i8 addrspace(4)* 24 %3 = bitcast %structtype addrspace(1)* @__block_literal_global.1 to i8 addrspace(1)* 25 %4 = addrspacecast i8 addrspace(1)* %3 to i8 addrspace(4)* 26 %5 = bitcast %structtype addrspace(1)* @__block_literal_global.2 to i8 addrspace(1)* 27 %6 = addrspacecast i8 addrspace(1)* %5 to i8 addrspace(4)* 28 br label %do.body 29 30do.body: ; preds = %do.cond, %entry 31 %a.0 = phi i32 [ undef, %entry ], [ %a.1, %do.cond ] 32 %call1 = call spir_func float @__block_typedef_mltpl_stmnt_block_invoke(i8 addrspace(4)* %2, float 0.000000e+00) 33 %call2 = call spir_func i32 @__block_typedef_mltpl_stmnt_block_invoke_2(i8 addrspace(4)* %4, i32 0) 34 %conv = sitofp i32 %call2 to float 35 %sub = fsub float %call1, %conv 36 %cmp = fcmp ogt float %sub, 0.000000e+00 37 br i1 %cmp, label %if.then, label %if.end 38 39if.then: ; preds = %do.body 40 %call4 = call spir_func i32 @__block_typedef_mltpl_stmnt_block_invoke_3(i8 addrspace(4)* %6, i32 1) 41 %call5 = call spir_func i32 @__block_typedef_mltpl_stmnt_block_invoke_3(i8 addrspace(4)* %6, i32 2) 42 %add = add i32 %call4, %call5 43 br label %cleanup 44 45if.end: ; preds = %do.body 46 br label %cleanup 47 48cleanup: ; preds = %if.end, %if.then 49 %a.1 = phi i32 [ %add, %if.then ], [ %a.0, %if.end ] 50 %cleanup.dest.slot.0 = phi i32 [ 2, %if.then ], [ 0, %if.end ] 51 switch i32 %cleanup.dest.slot.0, label %unreachable [ 52 i32 0, label %cleanup.cont 53 i32 2, label %do.end 54 ] 55 56cleanup.cont: ; preds = %cleanup 57 br label %do.cond 58 59do.cond: ; preds = %cleanup.cont 60 br i1 true, label %do.body, label %do.end 61 62do.end: ; preds = %do.cond, %cleanup 63 %sub7 = sub nsw i32 %a.1, 11 64 %arrayidx8 = getelementptr inbounds i32, i32 addrspace(1)* %res, i64 %call 65 store i32 %sub7, i32 addrspace(1)* %arrayidx8, align 4 66 ret void 67 68unreachable: ; preds = %cleanup 69 unreachable 70} 71 72define internal spir_func float @__block_typedef_mltpl_stmnt_block_invoke(i8 addrspace(4)* %.block_descriptor, float %bi) { 73entry: 74 %block = bitcast i8 addrspace(4)* %.block_descriptor to %structtype.0 addrspace(4)* 75 %conv = fpext float %bi to double 76 %add = fadd double %conv, 3.300000e+00 77 %conv1 = fptrunc double %add to float 78 ret float %conv1 79} 80 81define internal spir_func i32 @__block_typedef_mltpl_stmnt_block_invoke_2(i8 addrspace(4)* %.block_descriptor, i32 %bi) { 82entry: 83 %block = bitcast i8 addrspace(4)* %.block_descriptor to %structtype.0 addrspace(4)* 84 %add = add nsw i32 %bi, 2 85 ret i32 %add 86} 87 88define internal spir_func i32 @__block_typedef_mltpl_stmnt_block_invoke_3(i8 addrspace(4)* %.block_descriptor, i32 %bi) { 89entry: 90 %block = bitcast i8 addrspace(4)* %.block_descriptor to %structtype.0 addrspace(4)* 91 %add = add i32 %bi, 4 92 ret i32 %add 93} 94 95declare spir_func <3 x i64> @BuiltInGlobalInvocationId() 96