xref: /llvm-project/llvm/test/CodeGen/SPIRV/structurizer/basic-if.ll (revision 53326ee0cf45fce3f80e2e98638dd27edb20c516)
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 %}
3
4target triple = "spirv-unknown-vulkan1.3-compute"
5
6; Function Attrs: convergent noinline norecurse nounwind optnone
7define spir_func noundef i32 @_Z7processv() #0 {
8
9; CHECK: %[[#entry:]] = OpLabel
10; CHECK:                OpSelectionMerge %[[#merge:]] None
11; CHECK:                OpBranchConditional %[[#]] %[[#left:]] %[[#right:]]
12entry:
13  %0 = call token @llvm.experimental.convergence.entry()
14  %1 = alloca i32, align 4
15  br i1 true, label %left, label %right
16
17; CHECK: %[[#right]] = OpLabel
18; CHECK:               OpBranch %[[#merge]]
19right:
20  store i32 0, ptr %1
21  br label %end
22
23; CHECK: %[[#left]] = OpLabel
24; CHECK:              OpBranch %[[#merge]]
25left:
26  store i32 0, ptr %1
27  br label %end
28
29; CHECK: %[[#merge]] = OpLabel
30; CHECK:               OpReturnValue %[[#]]
31end:
32  ret i32 0
33}
34
35; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)
36declare token @llvm.experimental.convergence.entry() #1
37
38; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)
39declare token @llvm.experimental.convergence.loop() #1
40
41
42attributes #0 = { convergent noinline norecurse nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
43attributes #1 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }
44attributes #2 = { convergent norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
45attributes #3 = { convergent }
46
47!llvm.module.flags = !{!0, !1, !2}
48
49
50!0 = !{i32 1, !"wchar_size", i32 4}
51!1 = !{i32 4, !"dx.disable_optimizations", i32 1}
52!2 = !{i32 7, !"frame-pointer", i32 2}
53