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 ; int foo() { return 200; }
7 ; [numthreads(1, 1, 1)]
40 ; CHECK: %[[#func_14:]] = OpFunction %[[#uint:]] DontInline %[[#]]
41 ; CHECK: %[[#bb25:]] = OpLabel
42 ; CHECK: OpReturnValue %[[#]]
43 ; CHECK: OpFunctionEnd
44 ; CHECK: %[[#func_15:]] = OpFunction %[[#void:]] DontInline %[[#]]
45 ; CHECK: %[[#bb26:]] = OpLabel
46 ; CHECK: OpSelectionMerge %[[#bb27:]] None
47 ; CHECK: OpSwitch %[[#]] %[[#bb28:]] 4294967293 %[[#bb29:]] 0 %[[#bb30:]] 1 %[[#bb31:]] 2 %[[#bb32:]]
48 ; CHECK: %[[#bb28:]] = OpLabel
49 ; CHECK: OpBranch %[[#bb27:]]
50 ; CHECK: %[[#bb29:]] = OpLabel
51 ; CHECK: OpBranch %[[#bb27:]]
52 ; CHECK: %[[#bb30:]] = OpLabel
53 ; CHECK: OpBranch %[[#bb27:]]
54 ; CHECK: %[[#bb31:]] = OpLabel
55 ; CHECK: OpBranch %[[#bb27:]]
56 ; CHECK: %[[#bb32:]] = OpLabel
57 ; CHECK: OpBranch %[[#bb27:]]
58 ; CHECK: %[[#bb27:]] = OpLabel
59 ; CHECK: OpSelectionMerge %[[#bb33:]] None
60 ; CHECK: OpSwitch %[[#]] %[[#bb33:]] 4294967292 %[[#bb34:]] 4 %[[#bb35:]]
61 ; CHECK: %[[#bb34:]] = OpLabel
62 ; CHECK: OpBranch %[[#bb33:]]
63 ; CHECK: %[[#bb35:]] = OpLabel
64 ; CHECK: OpBranch %[[#bb33:]]
65 ; CHECK: %[[#bb33:]] = OpLabel
67 ; CHECK: OpFunctionEnd
68 ; CHECK: %[[#func_23:]] = OpFunction %[[#void:]] None %[[#]]
69 ; CHECK: %[[#bb36:]] = OpLabel
71 ; CHECK: OpFunctionEnd
75 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"
76 target triple = "spirv-unknown-vulkan1.3-compute"
78 ; Function Attrs: convergent noinline norecurse nounwind optnone
79 define spir_func noundef i32 @_Z3foov() #0 {
81 %0 = call token @llvm.experimental.convergence.entry()
85 ; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)
86 declare token @llvm.experimental.convergence.entry() #1
88 ; Function Attrs: convergent noinline norecurse nounwind optnone
89 define internal spir_func void @main() #0 {
91 %0 = call token @llvm.experimental.convergence.entry()
92 %result = alloca i32, align 4
93 %a = alloca i32, align 4
94 %c = alloca i32, align 4
95 store i32 0, ptr %a, align 4
96 %1 = load i32, ptr %a, align 4
97 switch i32 %1, label %sw.default [
104 sw.bb: ; preds = %entry
105 store i32 -300, ptr %result, align 4
108 sw.bb1: ; preds = %entry
109 store i32 0, ptr %result, align 4
112 sw.bb2: ; preds = %entry
113 store i32 100, ptr %result, align 4
116 sw.bb3: ; preds = %entry
117 %call4 = call spir_func noundef i32 @_Z3foov() #3 [ "convergencectrl"(token %0) ]
118 store i32 %call4, ptr %result, align 4
121 sw.default: ; preds = %entry
122 store i32 777, ptr %result, align 4
125 sw.epilog: ; preds = %sw.default, %sw.bb3, %sw.bb2, %sw.bb1, %sw.bb
126 %2 = load i32, ptr %a, align 4
127 store i32 %2, ptr %c, align 4
128 %3 = load i32, ptr %c, align 4
129 switch i32 %3, label %sw.epilog7 [
130 i32 -4, label %sw.bb5
134 sw.bb5: ; preds = %sw.epilog
135 store i32 -400, ptr %result, align 4
138 sw.bb6: ; preds = %sw.epilog
139 store i32 400, ptr %result, align 4
142 sw.epilog7: ; preds = %sw.epilog, %sw.bb6, %sw.bb5
146 ; Function Attrs: convergent norecurse
147 define void @main.1() #2 {
153 attributes #0 = { convergent noinline norecurse nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
154 attributes #1 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }
155 attributes #2 = { convergent norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
156 attributes #3 = { convergent }
158 !llvm.module.flags = !{!0, !1, !2}
161 !0 = !{i32 1, !"wchar_size", i32 4}
162 !1 = !{i32 4, !"dx.disable_optimizations", i32 1}
163 !2 = !{i32 7, !"frame-pointer", i32 2}