Skip to content

spirv: Fix handling of OpBranchConditional with same THEN and ELSE

When an OpBranchConditional that had two equal branches was parsed, we were treating it as a regular OpBranch. However this doesn't work well when there's an associated OpSelectionMerge. We ended up skipping marking the merge block as such, and depending on what was inside the construct we would end up trying to process the block twice.

Fix this by keeping the vtn_if around, but when emitting NIR identify the two equal branch case.

Fixes: 9c2a1143 ("spirv: Rewrite CFG construction") Closes: #3786 (closed), #4580 (closed)

Edited by Caio Oliveira

Merge request reports