1 ; RUN: %if spirv-tools %{ llc -mtriple=spirv-unknown-vulkan-compute -O0 %s -o - | spirv-as --preserve-numeric-ids - -o - | spirv-val %}
5 ; int foo() { return true; }
19 ; val = i; // No SPIR-V should be emitted for this statement.
20 ; while(true); // No SPIR-V should be emitted for this statement.
24 ; val = val * 2; // No SPIR-V should be emitted for this statement.
25 ; continue; // No SPIR-V should be emitted for this statement.
29 ; //////////////////////////////////////////////////////////////////////////////////////
30 ; // Nested do-while loops with continue statements //
31 ; // Each continue statement should branch to the corresponding loop's continue block //
32 ; //////////////////////////////////////////////////////////////////////////////////////
43 ; continue; // No SPIR-V should be emitted for this statement.
50 ; [numthreads(1, 1, 1)]
55 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"
56 target triple = "spirv-unknown-vulkan1.3-compute"
58 ; Function Attrs: convergent noinline nounwind optnone
59 define spir_func noundef i32 @_Z3foov() #0 {
61 %0 = call token @llvm.experimental.convergence.entry()
65 ; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)
66 declare token @llvm.experimental.convergence.entry() #1
68 ; Function Attrs: convergent noinline nounwind optnone
69 define spir_func noundef i32 @_Z7processv() #0 {
71 %0 = call token @llvm.experimental.convergence.entry()
72 %val = alloca i32, align 4
73 %i = alloca i32, align 4
74 store i32 0, ptr %val, align 4
75 store i32 0, ptr %i, align 4
78 do.body: ; preds = %do.cond, %entry
79 %1 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]
80 %2 = load i32, ptr %i, align 4
81 %inc = add nsw i32 %2, 1
82 store i32 %inc, ptr %i, align 4
83 %3 = load i32, ptr %i, align 4
84 %cmp = icmp sgt i32 %3, 5
85 br i1 %cmp, label %if.then, label %if.end
87 if.then: ; preds = %do.body
90 if.end: ; preds = %do.body
91 %4 = load i32, ptr %i, align 4
92 store i32 %4, ptr %val, align 4
95 do.cond: ; preds = %if.end, %if.then
96 %5 = load i32, ptr %i, align 4
97 %cmp1 = icmp slt i32 %5, 10
98 br i1 %cmp1, label %do.body, label %do.end
100 do.end: ; preds = %do.cond
103 do.body2: ; preds = %do.cond9, %do.end
104 %6 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]
105 %7 = load i32, ptr %i, align 4
106 %inc3 = add nsw i32 %7, 1
107 store i32 %inc3, ptr %i, align 4
110 do.body4: ; preds = %do.cond6, %do.body2
111 %8 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %6) ]
112 %9 = load i32, ptr %val, align 4
113 %inc5 = add nsw i32 %9, 1
114 store i32 %inc5, ptr %val, align 4
117 do.cond6: ; preds = %do.body4
118 %10 = load i32, ptr %i, align 4
119 %cmp7 = icmp slt i32 %10, 10
120 br i1 %cmp7, label %do.body4, label %do.end8
122 do.end8: ; preds = %do.cond6
123 %11 = load i32, ptr %i, align 4
124 %dec = add nsw i32 %11, -1
125 store i32 %dec, ptr %i, align 4
128 do.cond9: ; preds = %do.end8
129 %12 = load i32, ptr %val, align 4
130 %cmp10 = icmp slt i32 %12, 10
131 br i1 %cmp10, label %do.body2, label %do.end11
133 do.end11: ; preds = %do.cond9
134 %13 = load i32, ptr %val, align 4
138 ; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)
139 declare token @llvm.experimental.convergence.loop() #1
141 ; Function Attrs: convergent noinline norecurse nounwind optnone
142 define internal spir_func void @main() #2 {
144 %0 = call token @llvm.experimental.convergence.entry()
145 %call1 = call spir_func noundef i32 @_Z7processv() #4 [ "convergencectrl"(token %0) ]
149 ; Function Attrs: convergent norecurse
150 define void @main.1() #3 {
156 attributes #0 = { convergent noinline nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
157 attributes #1 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }
158 attributes #2 = { convergent noinline norecurse nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
159 attributes #3 = { convergent norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
160 attributes #4 = { convergent }
162 !llvm.module.flags = !{!0, !1, !2}
164 !0 = !{i32 1, !"wchar_size", i32 4}
165 !1 = !{i32 4, !"dx.disable_optimizations", i32 1}
166 !2 = !{i32 7, !"frame-pointer", i32 2}