brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.0 KiB · 4f8babb Raw
105 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 4; The goal of this test is to voluntarily create 2 overlapping convergence5; structures: the loop, and the inner condition.6; Here, the condition header also branches to 2 internal nodes, which are not7; directly a merge/exits.8; This will require a proper header-split.9; In addition, splitting the header makes the continue the merge of the inner10; condition, so we need to properly split the continue block to create a11; valid inner merge, in the correct order.12 13target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"14target triple = "spirv-unknown-vulkan1.3-compute"15 16; CHECK-DAG:    OpName %[[#switch_0:]] "reg1"17; CHECK-DAG:    OpName %[[#variable:]] "var"18 19; CHECK-DAG:    %[[#int_0:]] = OpConstant %[[#]] 020; CHECK-DAG:    %[[#int_1:]] = OpConstant %[[#]] 121; CHECK-DAG:    %[[#int_2:]] = OpConstant %[[#]] 222; CHECK-DAG:    %[[#int_3:]] = OpConstant %[[#]] 323; CHECK-DAG:    %[[#int_4:]] = OpConstant %[[#]] 424 25define internal spir_func void @main() #1 {26; CHECK:      %[[#entry:]] = OpLabel27; CHECK:    %[[#switch_0]] = OpVariable %[[#]] Function28; CHECK:    %[[#variable]] = OpVariable %[[#]] Function29; CHECK:                     OpBranch %[[#header:]]30entry:31  %0 = call token @llvm.experimental.convergence.entry()32  %var = alloca i32, align 433  br label %header34 35; CHECK: %[[#header]] = OpLabel36; CHECK:                OpLoopMerge %[[#merge:]] %[[#continue:]] None37; CHECK:                OpBranch %[[#split_header:]]38 39; CHECK: %[[#split_header]] = OpLabel40; CHECK:                      OpSelectionMerge %[[#inner_merge:]] None41; CHECK:                      OpBranchConditional %[[#]] %[[#left:]] %[[#right:]]42header:43  %2 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]44  br i1 true, label %left, label %right45 46; CHECK:     %[[#right]] = OpLabel47; CHECK-DAG:               OpStore %[[#switch_0]] %[[#int_0]]48; CHECK-DAG:               OpStore %[[#variable]] %[[#int_2]]49; CHECK:                   OpBranchConditional %[[#]] %[[#inner_merge]] %[[#right_next:]]50right:51  store i32 2, ptr %var52  br i1 true, label %merge, label %right_next53 54; CHECK:     %[[#right_next]] = OpLabel55; CHECK-DAG:                    OpStore %[[#switch_0]] %[[#int_1]]56; CHECK-DAG:                    OpStore %[[#variable]] %[[#int_4]]57; CHECK:                        OpBranch %[[#inner_merge]]58right_next:59  store i32 4, ptr %var60  br label %continue61 62; CHECK:     %[[#left]] = OpLabel63; CHECK-DAG:              OpStore %[[#switch_0]] %[[#int_0]]64; CHECK-DAG:              OpStore %[[#variable]] %[[#int_1]]65; CHECK:                  OpBranchConditional %[[#]] %[[#inner_merge]] %[[#left_next:]]66left:67  store i32 1, ptr %var68  br i1 true, label %merge, label %left_next69 70; CHECK:     %[[#left_next]] = OpLabel71; CHECK-DAG:                   OpStore %[[#switch_0]] %[[#int_1]]72; CHECK-DAG:                   OpStore %[[#variable]] %[[#int_3]]73; CHECK:                       OpBranch %[[#inner_merge]]74left_next:75  store i32 3, ptr %var76  br label %continue77 78; CHECK: %[[#inner_merge]] = OpLabel79; CHECK:        %[[#tmp:]] = OpLoad %[[#]] %[[#switch_0]]80; CHECK:       %[[#cond:]] = OpIEqual %[[#]] %[[#int_0]] %[[#tmp]]81; CHECK:                     OpBranchConditional %[[#cond]] %[[#merge]] %[[#continue]]82 83; CHECK: %[[#continue]] = OpLabel84; CHECK:                  OpBranch %[[#header]]85continue:86  br label %header87 88; CHECK: %[[#merge]] = OpLabel89; CHECK:               OpReturn90merge:91  ret void92}93 94 95declare token @llvm.experimental.convergence.entry() #096declare token @llvm.experimental.convergence.loop() #097 98attributes #0 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }99attributes #1 = { convergent noinline norecurse nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }100 101!llvm.module.flags = !{!0, !1}102 103!0 = !{i32 1, !"wchar_size", i32 4}104!1 = !{i32 4, !"dx.disable_optimizations", i32 1}105