-
Notifications
You must be signed in to change notification settings - Fork 664
spirv-opt improper inlining OpKill into continue construct #2433
Copy link
Copy link
Description
@alan-baker asked me to open this issue here from KhronosGroup/SPIRV-Headers#86
Original issue:
Is a continue construct that consists of OpKill valid? If so, the rules on the header block post-dominating the continue construct need to be fixed. Otherwise, there's a bug in spirv-opt where kill() is improperly inlined.
http://shader-playground.timjones.io/1323167d9be3ec6d7a54996e098612de
spirv-opt output:
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 13
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main"
OpExecutionMode %main OriginUpperLeft
OpSource GLSL 330
OpName %main "main"
%void = OpTypeVoid
%3 = OpTypeFunction %void
%main = OpFunction %void None %3
%5 = OpLabel
OpLoopMerge %11 %12 None
OpBranch %12
%12 = OpLabel
OpKill
%11 = OpLabel
OpUnreachable
OpFunctionEnd
spirv-opt input:
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 17
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source GLSL 330
Name 4 "main"
Name 6 "kill("
2: TypeVoid
3: TypeFunction 2
14: TypeBool
15: 14(bool) ConstantTrue
4(main): 2 Function None 3
5: Label
Branch 9
9: Label
LoopMerge 11 12 None
Branch 13
13: Label
BranchConditional 15 10 11
10: Label
Branch 12
12: Label
16: 2 FunctionCall 6(kill()
Branch 9
11: Label
Return
FunctionEnd
6(kill(): 2 Function None 3
7: Label
Kill
FunctionEnd
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels