101 lines · plain
1; RUN: llc -mtriple=spirv-unknown-vulkan-compute -O0 %s -o - | FileCheck %s2; 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:]] = OpLabel38; CHECK: OpReturnValue %[[#]]39; CHECK: OpFunctionEnd40; CHECK: %[[#func_15:]] = OpFunction %[[#void:]] DontInline %[[#]]41; CHECK: %[[#bb20:]] = OpLabel42; CHECK: OpReturn43; CHECK: OpFunctionEnd44; CHECK: %[[#func_17:]] = OpFunction %[[#void:]] None %[[#]]45; CHECK: %[[#bb21:]] = OpLabel46; CHECK: OpReturn47; CHECK: OpFunctionEnd48 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 optnone55define spir_func noundef i32 @_Z7processv() #0 {56entry:57 %0 = call token @llvm.experimental.convergence.entry()58 %a = alloca i32, align 459 %b = alloca i32, align 460 store i32 0, ptr %a, align 461 store i32 0, ptr %b, align 462 store i32 1, ptr %a, align 463 store i32 2, ptr %b, align 464 %1 = load i32, ptr %a, align 465 %2 = load i32, ptr %b, align 466 %add = add nsw i32 %1, %267 ret i32 %add68}69 70; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)71declare token @llvm.experimental.convergence.entry() #172 73; Function Attrs: convergent noinline norecurse nounwind optnone74define 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 void79}80 81; Function Attrs: convergent norecurse82define void @main.1() #2 {83entry:84 call void @main()85 ret void86}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