xref: /llvm-project/llvm/test/CodeGen/SPIRV/structurizer/phi-exit.ll (revision cba70550ccf55c6ad3daa621bb8caf3c4ca6cbd7)
1; RUN: llc -mtriple=spirv-unknown-vulkan-compute -O0 %s -o - | FileCheck %s --match-full-lines
2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan-compute %s -o - -filetype=obj | spirv-val %}
3
4target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"
5target triple = "spirv-unknown-vulkan1.3-compute"
6
7define internal spir_func void @main() #1 {
8; CHECK: %[[#entry:]] = OpLabel
9; CHECK:                OpBranch %[[#do_body:]]
10entry:
11  %0 = call token @llvm.experimental.convergence.entry()
12  %a = alloca i32, align 4
13  br label %loop_body
14
15loop_body:
16  br i1 true, label %left, label %right
17
18left:
19  br i1 true, label %loop_exit, label %loop_continue
20
21right:
22  br i1 true, label %loop_exit, label %loop_continue
23
24loop_continue:
25  br label %loop_body
26
27loop_exit:
28  %r = phi i32 [ 0, %left ], [ 1, %right ]
29  store i32 %r, ptr %a, align 4
30  ret void
31
32}
33
34
35declare token @llvm.experimental.convergence.entry() #0
36declare token @llvm.experimental.convergence.loop() #0
37
38attributes #0 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }
39attributes #1 = { convergent noinline norecurse nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
40
41!llvm.module.flags = !{!0, !1}
42
43!0 = !{i32 1, !"wchar_size", i32 4}
44!1 = !{i32 4, !"dx.disable_optimizations", i32 1}
45
46