GLSL:
#version 310 es
precision highp float;
void main()
{
switch(0)
{
case 0:
if(false)
{
}
else
{
}
}
}
SPIR-V:
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 15
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %4 "main"
OpExecutionMode %4 OriginUpperLeft
OpSource ESSL 310
OpName %4 "main"
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%6 = OpTypeInt 32 1
%7 = OpConstant %6 0
%10 = OpTypeBool
%11 = OpConstantFalse %10
%4 = OpFunction %2 None %3
%5 = OpLabel
OpSelectionMerge %9 None
OpSwitch %7 %9 0 %8
%8 = OpLabel
OpSelectionMerge %13 None
OpBranchConditional %11 %12 %13
%12 = OpLabel
OpBranch %13
%13 = OpLabel
OpBranch %9
%9 = OpLabel
OpReturn
OpFunctionEnd
See zip below. To reproduce:
# Optional.
glslangValidator -V shader.frag -o shader.spv
catchsegv spirv-opt -O shader.spv -o shader_opt.spv
reproduce.zip