spirv: Handle OpBranchConditional with the same lables
Consider CFG of this code:
...
%B5 = OpLabel
OpSelectionMerge %B8 None
OpBranchConditional %true %B6 %B6
%B6 = OpLabel
OpBranchConditional %true %B7 %B8
%B7 = OpLabel
OpBranch %B8
%B8 = OpLabel
OpReturn
OpFunctionEnd
...
In this case, after processing %B5
, we want to jump to its merge node,
%B8
. So we can't just treat conditional branches with the same labels
as unconditional.
In the presence of a merge node, we preserve this construct in a form
of vtn_if
with only then
branch set up. We get rid of it later in
vtn_emit_cf_list_structured
.
Signed-off-by: Yevhenii Kolesnikov yevhenii.kolesnikov@globallogic.com Closes: #3786 (closed)