1 ; RUN: llc -mtriple=spirv-unknown-vulkan-compute -O0 %s -o - | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan-compute %s -o - -filetype=obj | spirv-val %}
28 ; [numthreads(1, 1, 1)]
33 ; CHECK: %[[#func_11:]] = OpFunction %[[#uint:]] DontInline %[[#]]
34 ; CHECK: %[[#bb30:]] = OpLabel
35 ; CHECK: OpSelectionMerge %[[#bb31:]] None
36 ; CHECK: OpBranchConditional %[[#]] %[[#bb32:]] %[[#bb33:]]
37 ; CHECK: %[[#bb32:]] = OpLabel
38 ; CHECK: OpSelectionMerge %[[#bb34:]] None
39 ; CHECK: OpBranchConditional %[[#]] %[[#bb35:]] %[[#bb34:]]
40 ; CHECK: %[[#bb33:]] = OpLabel
41 ; CHECK: OpSelectionMerge %[[#bb36:]] None
42 ; CHECK: OpBranchConditional %[[#]] %[[#bb37:]] %[[#bb38:]]
43 ; CHECK: %[[#bb35:]] = OpLabel
44 ; CHECK: OpBranch %[[#bb34:]]
45 ; CHECK: %[[#bb37:]] = OpLabel
46 ; CHECK: OpBranch %[[#bb36:]]
47 ; CHECK: %[[#bb38:]] = OpLabel
48 ; CHECK: OpSelectionMerge %[[#bb39:]] None
49 ; CHECK: OpBranchConditional %[[#]] %[[#bb40:]] %[[#bb39:]]
50 ; CHECK: %[[#bb34:]] = OpLabel
51 ; CHECK: OpBranch %[[#bb31:]]
52 ; CHECK: %[[#bb40:]] = OpLabel
53 ; CHECK: OpBranch %[[#bb39:]]
54 ; CHECK: %[[#bb39:]] = OpLabel
55 ; CHECK: OpBranch %[[#bb36:]]
56 ; CHECK: %[[#bb36:]] = OpLabel
57 ; CHECK: OpBranch %[[#bb31:]]
58 ; CHECK: %[[#bb31:]] = OpLabel
59 ; CHECK: OpReturnValue %[[#]]
60 ; CHECK: OpFunctionEnd
61 ; CHECK: %[[#func_26:]] = OpFunction %[[#void:]] DontInline %[[#]]
62 ; CHECK: %[[#bb41:]] = OpLabel
64 ; CHECK: OpFunctionEnd
65 ; CHECK: %[[#func_28:]] = OpFunction %[[#void:]] None %[[#]]
66 ; CHECK: %[[#bb42:]] = OpLabel
68 ; CHECK: OpFunctionEnd
70 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"
71 target triple = "spirv-unknown-vulkan1.3-compute"
73 ; Function Attrs: convergent noinline norecurse nounwind optnone
74 define spir_func noundef i32 @_Z7processv() #0 {
76 %0 = call token @llvm.experimental.convergence.entry()
77 %c1 = alloca i32, align 4
78 %c2 = alloca i32, align 4
79 %c3 = alloca i32, align 4
80 %c4 = alloca i32, align 4
81 %val = alloca i32, align 4
82 store i32 0, ptr %c1, align 4
83 store i32 1, ptr %c2, align 4
84 store i32 0, ptr %c3, align 4
85 store i32 1, ptr %c4, align 4
86 store i32 0, ptr %val, align 4
87 %1 = load i32, ptr %c1, align 4
88 %tobool = icmp ne i32 %1, 0
89 br i1 %tobool, label %if.then, label %if.else
91 if.then: ; preds = %entry
92 %2 = load i32, ptr %c2, align 4
93 %tobool1 = icmp ne i32 %2, 0
94 br i1 %tobool1, label %if.then2, label %if.end
96 if.then2: ; preds = %if.then
97 store i32 1, ptr %val, align 4
100 if.end: ; preds = %if.then2, %if.then
103 if.else: ; preds = %entry
104 %3 = load i32, ptr %c3, align 4
105 %tobool3 = icmp ne i32 %3, 0
106 br i1 %tobool3, label %if.then4, label %if.else5
108 if.then4: ; preds = %if.else
109 store i32 2, ptr %val, align 4
112 if.else5: ; preds = %if.else
113 %4 = load i32, ptr %c4, align 4
114 %tobool6 = icmp ne i32 %4, 0
115 br i1 %tobool6, label %if.then7, label %if.end8
117 if.then7: ; preds = %if.else5
118 store i32 3, ptr %val, align 4
121 if.end8: ; preds = %if.then7, %if.else5
124 if.end9: ; preds = %if.end8, %if.then4
127 if.end10: ; preds = %if.end9, %if.end
128 %5 = load i32, ptr %val, align 4
132 ; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)
133 declare token @llvm.experimental.convergence.entry() #1
135 ; Function Attrs: convergent noinline norecurse nounwind optnone
136 define internal spir_func void @main() #0 {
138 %0 = call token @llvm.experimental.convergence.entry()
139 %call1 = call spir_func noundef i32 @_Z7processv() #3 [ "convergencectrl"(token %0) ]
143 ; Function Attrs: convergent norecurse
144 define void @main.1() #2 {
150 attributes #0 = { convergent noinline norecurse nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
151 attributes #1 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }
152 attributes #2 = { convergent norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
153 attributes #3 = { convergent }
155 !llvm.module.flags = !{!0, !1, !2}
158 !0 = !{i32 1, !"wchar_size", i32 4}
159 !1 = !{i32 4, !"dx.disable_optimizations", i32 1}
160 !2 = !{i32 7, !"frame-pointer", i32 2}