Files
wgpu/naga/tests/out/spv/6220-break-from-loop.spvasm
T
Jim Blandy e432980a73 [naga spv-out] Don't emit unreachable blocks that jump into loops.
When generating SPIR-V, avoid generating unreachable blocks following
statements like `break`, `return`, and so on that cause non-local
exits. These unreachable blocks can cause SPIR-V validation to fail.

Fixes #6220.
2024-10-03 21:07:18 -07:00

44 lines
841 B
Plaintext

; SPIR-V
; Version: 1.1
; Generator: rspirv
; Bound: 26
OpCapability Shader
OpCapability Linkage
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
%2 = OpTypeVoid
%3 = OpTypeInt 32 1
%6 = OpTypeFunction %2
%7 = OpConstant %3 0
%8 = OpConstant %3 4
%9 = OpConstant %3 1
%11 = OpTypePointer Function %3
%18 = OpTypeBool
%5 = OpFunction %2 None %6
%4 = OpLabel
%10 = OpVariable %11 Function %7
OpBranch %12
%12 = OpLabel
OpBranch %13
%13 = OpLabel
OpLoopMerge %14 %16 None
OpBranch %15
%15 = OpLabel
%17 = OpLoad %3 %10
%19 = OpSLessThan %18 %17 %8
OpSelectionMerge %20 None
OpBranchConditional %19 %20 %21
%21 = OpLabel
OpBranch %14
%20 = OpLabel
OpBranch %22
%22 = OpLabel
OpBranch %14
%16 = OpLabel
%24 = OpLoad %3 %10
%25 = OpIAdd %3 %24 %9
OpStore %10 %25
OpBranch %13
%14 = OpLabel
OpReturn
OpFunctionEnd