SPIRV-Cross/shaders-no-opt/asm/comp/access-chain-dominator-in-loop-body-2.asm.comp
Hans-Kristian Arntzen e23c9ea700 Force complex loop in certain rare access chain scenarios.
If we generate an access chain in a loop body, and it is consumed in the
loop continue block, we have a problem because we cannot emit a
temporary here holding the access chain reference. Force a complex loop
body to workaround this exceptionally rare case.
2019-04-10 16:02:03 +02:00

56 lines
2.0 KiB
Plaintext

; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 52
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpSource GLSL 450
OpName %main "main"
OpName %SSBO "SSBO"
OpMemberName %SSBO 0 "values"
OpName %_ ""
OpDecorate %_runtimearr_int ArrayStride 4
OpMemberDecorate %SSBO 0 Offset 0
OpDecorate %SSBO BufferBlock
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
%void = OpTypeVoid
%3 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%int_100 = OpConstant %int 100
%bool = OpTypeBool
%_runtimearr_int = OpTypeRuntimeArray %int
%SSBO = OpTypeStruct %_runtimearr_int
%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO
%_ = OpVariable %_ptr_Uniform_SSBO Uniform
%_ptr_Uniform_int = OpTypePointer Uniform %int
%int_1 = OpConstant %int 1
%main = OpFunction %void None %3
%5 = OpLabel
OpBranch %32
%32 = OpLabel
%51 = OpPhi %int %int_0 %5 %49 %loop_continue
%38 = OpSLessThan %bool %51 %int_100
OpLoopMerge %loop_merge %loop_continue None
OpBranchConditional %38 %loop_body %loop_merge
%loop_body = OpLabel
%40 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %51
OpBranch %loop_continue
%loop_continue = OpLabel
%41 = OpLoad %int %40
%44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %41
OpStore %44 %51
%47 = OpIAdd %int %41 %int_1
%48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %47
%49 = OpLoad %int %48
OpStore %40 %49
OpBranch %32
%loop_merge = OpLabel
OpReturn
OpFunctionEnd