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 4; 5; int process() { 6; int a = 0; 7; int b = 0; 8; 9; if (3 + 5) { 10; a = 1; 11; } else { 12; a = 0; 13; } 14; 15; if (4 + 3 > 7 || 4 + 3 < 8) { 16; b = 2; 17; } 18; 19; if (4 + 3 > 7 && true) { 20; b = 0; 21; } 22; 23; if (true) 24; ; 25; 26; if (false) {} 27; 28; return a + b; 29; } 30; 31; [numthreads(1, 1, 1)] 32; void main() { 33; process(); 34; } 35 36; CHECK: %[[#func_9:]] = OpFunction %[[#uint:]] DontInline %[[#]] 37; CHECK: %[[#bb19:]] = OpLabel 38; CHECK: OpReturnValue %[[#]] 39; CHECK: OpFunctionEnd 40; CHECK: %[[#func_15:]] = OpFunction %[[#void:]] DontInline %[[#]] 41; CHECK: %[[#bb20:]] = OpLabel 42; CHECK: OpReturn 43; CHECK: OpFunctionEnd 44; CHECK: %[[#func_17:]] = OpFunction %[[#void:]] None %[[#]] 45; CHECK: %[[#bb21:]] = OpLabel 46; CHECK: OpReturn 47; CHECK: OpFunctionEnd 48 49 50 51target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1" 52target triple = "spirv-unknown-vulkan1.3-compute" 53 54; Function Attrs: convergent noinline norecurse nounwind optnone 55define spir_func noundef i32 @_Z7processv() #0 { 56entry: 57 %0 = call token @llvm.experimental.convergence.entry() 58 %a = alloca i32, align 4 59 %b = alloca i32, align 4 60 store i32 0, ptr %a, align 4 61 store i32 0, ptr %b, align 4 62 store i32 1, ptr %a, align 4 63 store i32 2, ptr %b, align 4 64 %1 = load i32, ptr %a, align 4 65 %2 = load i32, ptr %b, align 4 66 %add = add nsw i32 %1, %2 67 ret i32 %add 68} 69 70; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none) 71declare token @llvm.experimental.convergence.entry() #1 72 73; Function Attrs: convergent noinline norecurse nounwind optnone 74define internal spir_func void @main() #0 { 75entry: 76 %0 = call token @llvm.experimental.convergence.entry() 77 %call1 = call spir_func noundef i32 @_Z7processv() #3 [ "convergencectrl"(token %0) ] 78 ret void 79} 80 81; Function Attrs: convergent norecurse 82define void @main.1() #2 { 83entry: 84 call void @main() 85 ret void 86} 87 88attributes #0 = { convergent noinline norecurse nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" } 89attributes #1 = { convergent nocallback nofree nosync nounwind willreturn memory(none) } 90attributes #2 = { convergent norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" } 91attributes #3 = { convergent } 92 93!llvm.module.flags = !{!0, !1, !2} 94 95 96!0 = !{i32 1, !"wchar_size", i32 4} 97!1 = !{i32 4, !"dx.disable_optimizations", i32 1} 98!2 = !{i32 7, !"frame-pointer", i32 2} 99 100 101