1 ; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
5 ; CHECK: %[[#bool:]] = OpTypeBool
6 ; CHECK: %[[#true:]] = OpConstantTrue %[[#bool]]
7 ; CHECK: OpBranchConditional %[[#true]]
9 %structtype = type { i32, i32, i8 addrspace(4)* }
10 %structtype.0 = type <{ i32, i32, i8 addrspace(4)* }>
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
16 define spir_kernel void @block_typedef_mltpl_stmnt(i32 addrspace(1)* %res) {
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)*
30 do.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
39 if.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
45 if.end: ; preds = %do.body
48 cleanup: ; 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
56 cleanup.cont: ; preds = %cleanup
59 do.cond: ; preds = %cleanup.cont
60 br i1 true, label %do.body, label %do.end
62 do.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
68 unreachable: ; preds = %cleanup
72 define internal spir_func float @__block_typedef_mltpl_stmnt_block_invoke(i8 addrspace(4)* %.block_descriptor, float %bi) {
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
81 define internal spir_func i32 @__block_typedef_mltpl_stmnt_block_invoke_2(i8 addrspace(4)* %.block_descriptor, i32 %bi) {
83 %block = bitcast i8 addrspace(4)* %.block_descriptor to %structtype.0 addrspace(4)*
84 %add = add nsw i32 %bi, 2
88 define internal spir_func i32 @__block_typedef_mltpl_stmnt_block_invoke_3(i8 addrspace(4)* %.block_descriptor, i32 %bi) {
90 %block = bitcast i8 addrspace(4)* %.block_descriptor to %structtype.0 addrspace(4)*
95 declare spir_func <3 x i64> @BuiltInGlobalInvocationId()