fix(recompiler): give an early-return selection that joins its parent's merge a merge of its own #413
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/413"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-02T22:06:10Z.
What
A selection whose one arm only returns (a kill or
s_endpgmtail) and whose other arm branches straight to the merge of an enclosing selection got no structured merge. The returning arm has no join, and the other target belongs to the parent construct, sofindSelectionMergefinds nothing, no existing split applies, and the shader fails to structurize, which skips the draw. PPSA21564's BotEye G-buffer pixel shaders (eight variants) have this shape; the crowd robots and the mothership lose their visors and eyes.splitSharedMergeBlocksnow has a last split,splitOneReturnJoin, tried after the loop and selection merge splits. For a conditional branch outside any loop with no selection merge, where:the edge from the header's region to that join is split into an empty block (
splitSharedMergeBlock), which becomes the header's own merge. The enclosing selection keeps the original join as its merge.This is the selection counterpart of #275 (exit-tail branches inside loops):
splitOneReturnJoinskips blocks inside a loop, so the two do not overlap.Tests:
agc_structurizer_tests: the bare graph (an early return inside a selection that joins its parent's merge) structurizes, and every header dominates its merge.agc_shader_control_flow_tests: an RDNA program with that shape recompiles with neither cloning nor route variables (a newSplit::Noneexpectation).Tested
ctest125/125 pass. WithStructurizer.cppreverted tomain,agc_structurizer_testsfails with "conditional block 1 has no structured merge" andagc_shader_control_flow_testsfails on the new program.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)