106 lines · plain
1; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan-compute %s -o - -filetype=obj | spirv-val %}2; RUN: llc -mtriple=spirv-unknown-vulkan-compute -O0 %s -o - | FileCheck %s3 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 7; CHECK-DAG: OpName %[[#process:]] "_Z7processv"8; CHECK-DAG: OpName %[[#val:]] "val"9; CHECK-DAG: OpName %[[#i:]] "i"10 11; CHECK-DAG: %[[#int_ty:]] = OpTypeInt 32 012; CHECK-DAG: %[[#int_pfty:]] = OpTypePointer Function %[[#int_ty]]13; CHECK-DAG: %[[#false:]] = OpConstantFalse14 15 16; CHECK: %[[#process]] = OpFunction %[[#]] DontInline %[[#]]17define spir_func noundef i32 @_Z7processv() #0 {18entry:19 %0 = call token @llvm.experimental.convergence.entry()20 21 ; CHECK-DAG: %[[#val]] = OpVariable %[[#int_pfty]] Function22 ; CHECK-DAG: %[[#i]] = OpVariable %[[#int_pfty]] Function23 %val = alloca i32, align 424 %i = alloca i32, align 425 store i32 0, ptr %val, align 426 store i32 0, ptr %i, align 427 br label %for.cond28 ; CHECK: OpBranch %[[#for_cond:]]29 30for.cond: ; preds = %for.inc, %entry31 ; CHECK: %[[#for_cond]] = OpLabel32 %1 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]33 %2 = load i32, ptr %i, align 434 %cmp = icmp slt i32 %2, 1035 36 ; CHECK: OpLoopMerge %[[#for_end:]] %[[#for_inc:]]37 ; CHECK: OpBranchConditional %[[#]] %[[#for_body:]] %[[#for_end]]38 br i1 %cmp, label %for.body, label %for.end39 40for.end: ; preds = %for.cond41 br label %for.cond142 ; CHECK: %[[#for_end]] = OpLabel43 ; CHECK: OpBranch %[[#for_cond1:]]44 45for.cond1: ; preds = %for.cond1, %for.end46 %3 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]47 store i32 0, ptr %val, align 448 br label %for.cond149 ; CHECK: %[[#for_cond1]] = OpLabel50 ; CHECK: OpLoopMerge %[[#unreachable:]] %[[#for_cond1]]51 ; CHECK: OpBranchConditional %[[#false]] %[[#unreachable]] %[[#for_cond1]]52 53 ; CHECK: %[[#unreachable]] = OpLabel54 ; CHECK-NEXT: OpUnreachable55 56for.body: ; preds = %for.cond57 %4 = load i32, ptr %i, align 458 store i32 %4, ptr %val, align 459 br label %for.inc60 ; CHECK: %[[#for_body]] = OpLabel61 ; CHECK: OpBranch %[[#for_inc]]62 63for.inc: ; preds = %for.body64 %5 = load i32, ptr %i, align 465 %inc = add nsw i32 %5, 166 store i32 %inc, ptr %i, align 467 br label %for.cond68 ; CHECK: %[[#for_inc]] = OpLabel69 ; CHECK: OpBranch %[[#for_cond]]70 71 72}73 74; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)75declare token @llvm.experimental.convergence.entry() #176 77; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)78declare token @llvm.experimental.convergence.loop() #179 80; Function Attrs: convergent noinline norecurse nounwind optnone81define internal spir_func void @main() #2 {82entry:83 %0 = call token @llvm.experimental.convergence.entry()84 %call1 = call spir_func noundef i32 @_Z7processv() #4 [ "convergencectrl"(token %0) ]85 ret void86}87 88; Function Attrs: convergent norecurse89define void @main.1() #3 {90entry:91 call void @main()92 ret void93}94 95attributes #0 = { convergent noinline nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }96attributes #1 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }97attributes #2 = { convergent noinline norecurse nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }98attributes #3 = { convergent norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }99attributes #4 = { convergent }100 101!llvm.module.flags = !{!0, !1, !2}102 103!0 = !{i32 1, !"wchar_size", i32 4}104!1 = !{i32 4, !"dx.disable_optimizations", i32 1}105!2 = !{i32 7, !"frame-pointer", i32 2}106