brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 9642d0a Raw
61 lines · plain
1; RUN: %if spirv-tools %{ spirv-as --target-env spv1.0 %s -o - | mlir-translate --deserialize-spirv - -o - | FileCheck %s %}2 3; COM: The purpose of this test is to check that a variable (in this case %color) that4; COM: is defined before a selection region and used both in the selection region and5; COM: after it, is not sunk into that selection region by the deserializer. If the6; COM: variable is sunk, then it cannot be accessed outside the region and causes7; COM: control-flow structurization to fail.8 9; CHECK:      spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {10; CHECK:        spirv.func @main() "None" {11; CHECK:          spirv.Variable : !spirv.ptr<vector<4xf32>, Function>12; CHECK:          spirv.mlir.selection {13; CHECK-NEXT:       spirv.BranchConditional {{.*}}, ^[[bb:.+]], ^[[bb:.+]]14; CHECK-NEXT:     ^[[bb:.+]]15; CHECK:            spirv.Branch ^[[bb:.+]]16; CHECK-NEXT:     ^[[bb:.+]]:17; CHECK-NEXT:       spirv.mlir.merge18; CHECK-NEXT:     }19; CHECK:          spirv.Return20; CHECK-NEXT:   }21; CHECK:      }22 23               OpCapability Shader24          %2 = OpExtInstImport "GLSL.std.450"25               OpMemoryModel Logical GLSL45026               OpEntryPoint Fragment %main "main" %colorOut27               OpExecutionMode %main OriginUpperLeft28               OpDecorate %colorOut Location 029       %void = OpTypeVoid30          %4 = OpTypeFunction %void31      %float = OpTypeFloat 3232    %v4float = OpTypeVector %float 433%fun_v4float = OpTypePointer Function %v4float34    %float_1 = OpConstant %float 135    %float_0 = OpConstant %float 036         %13 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_137%out_v4float = OpTypePointer Output %v4float38   %colorOut = OpVariable %out_v4float Output   39       %uint = OpTypeInt 32 040     %uint_0 = OpConstant %uint 041  %out_float = OpTypePointer Output %float42       %bool = OpTypeBool43         %25 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_144       %main = OpFunction %void None %445          %6 = OpLabel46      %color = OpVariable %fun_v4float Function47               OpStore %color %1348         %19 = OpAccessChain %out_float %colorOut %uint_049         %20 = OpLoad %float %1950         %22 = OpFOrdEqual %bool %20 %float_151               OpSelectionMerge %24 None52               OpBranchConditional %22 %23 %2453         %23 = OpLabel54               OpStore %color %2555               OpBranch %2456         %24 = OpLabel57         %26 = OpLoad %v4float %color58               OpStore %colorOut %2659               OpReturn60               OpFunctionEnd61