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 %}
5 ; [numthreads(1, 1, 1)]
24 ; CHECK: %[[#func_8:]] = OpFunction %[[#void:]] DontInline %[[#]]
25 ; CHECK: %[[#bb22:]] = OpLabel
26 ; CHECK: OpBranch %[[#bb23:]]
27 ; CHECK: %[[#bb23:]] = OpLabel
28 ; CHECK: OpSelectionMerge %[[#bb24:]] None
29 ; CHECK: OpBranchConditional %[[#]] %[[#bb25:]] %[[#bb24:]]
30 ; CHECK: %[[#bb25:]] = OpLabel
31 ; CHECK: OpBranch %[[#bb26:]]
32 ; CHECK: %[[#bb26:]] = OpLabel
33 ; CHECK: OpSelectionMerge %[[#bb27:]] None
34 ; CHECK: OpBranchConditional %[[#]] %[[#bb27:]] %[[#bb28:]]
35 ; CHECK: %[[#bb28:]] = OpLabel
36 ; CHECK: OpBranch %[[#bb27:]]
37 ; CHECK: %[[#bb27:]] = OpLabel
38 ; CHECK: OpBranchConditional %[[#]] %[[#bb29:]] %[[#bb24:]]
39 ; CHECK: %[[#bb29:]] = OpLabel
40 ; CHECK: OpSelectionMerge %[[#bb30:]] None
41 ; CHECK: OpBranchConditional %[[#]] %[[#bb30:]] %[[#bb31:]]
42 ; CHECK: %[[#bb31:]] = OpLabel
43 ; CHECK: OpBranch %[[#bb30:]]
44 ; CHECK: %[[#bb30:]] = OpLabel
45 ; CHECK: OpBranch %[[#bb24:]]
46 ; CHECK: %[[#bb24:]] = OpLabel
48 ; CHECK: OpFunctionEnd
49 ; CHECK: %[[#func_20:]] = OpFunction %[[#void:]] None %[[#]]
50 ; CHECK: %[[#bb32:]] = OpLabel
52 ; CHECK: OpFunctionEnd
54 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"
55 target triple = "spirv-unknown-vulkan1.3-compute"
57 ; Function Attrs: convergent noinline norecurse nounwind optnone
58 define internal spir_func void @main() #0 {
60 %0 = call token @llvm.experimental.convergence.entry()
61 %a = alloca i32, align 4
62 %b = alloca i32, align 4
63 %cond = alloca i32, align 4
64 store i32 1, ptr %cond, align 4
67 while.cond: ; preds = %entry
68 %1 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]
69 %2 = load i32, ptr %cond, align 4
70 %tobool = icmp ne i32 %2, 0
71 br i1 %tobool, label %while.body, label %while.end
73 while.body: ; preds = %while.cond
74 %3 = load i32, ptr %b, align 4
75 switch i32 %3, label %sw.default [
78 sw.default: ; preds = %while.body
79 %4 = load i32, ptr %cond, align 4
80 %tobool1 = icmp ne i32 %4, 0
81 br i1 %tobool1, label %if.then, label %if.end
83 if.then: ; preds = %sw.default
84 %5 = load i32, ptr %cond, align 4
85 %tobool2 = icmp ne i32 %5, 0
86 br i1 %tobool2, label %if.then3, label %if.else
88 if.then3: ; preds = %if.then
91 if.else: ; preds = %if.then
94 if.end: ; preds = %sw.default
97 sw.epilog: ; preds = %if.end
100 while.end: ; preds = %if.then3, %if.else, %sw.epilog, %while.cond
104 ; Function Attrs: convergent norecurse
105 define void @main.1() #1 {
111 ; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)
112 declare token @llvm.experimental.convergence.entry() #2
114 ; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)
115 declare token @llvm.experimental.convergence.loop() #2
117 attributes #0 = { convergent noinline norecurse nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
118 attributes #1 = { convergent norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
119 attributes #2 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }
121 !llvm.module.flags = !{!0, !1, !2}
124 !0 = !{i32 1, !"wchar_size", i32 4}
125 !1 = !{i32 4, !"dx.disable_optimizations", i32 1}
126 !2 = !{i32 7, !"frame-pointer", i32 2}