refactor(recompiler): share the control flow helpers #1493
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1493"
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 LeandroLP23 on 2026-10-08T09:09:30Z.
What
Eight helpers were defined with identical bodies in the anonymous namespaces of two of the three control flow sources:
addUnique,sortUnique,remapId,remapIds,rebuildPredecessorsGraphBuilder.cpp,Structurizer.cppcontains,intersectSortedControlFlowGraph.cpp,Structurizer.cpptoHexStringControlFlowGraph.cpp,GraphBuilder.cppControlFlow/ControlFlowHelpers.hppand defined once inControlFlowGraph.cpp; bodies are unchangedControlFlowGraph.cpp,GraphBuilder.cppandStructurizer.cppinclude the header. It is not added toControlFlowGraph.hpp, which eight recompiler sources include, since generic names such ascontainswould then meet the helpers and calls of that name in other componentsRdnaDecoderkeeps its owntoHexString, which is in an anonymous namespace and does not clashNo behaviour change.
Tested
Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release with
BUILD_TESTING=ON. No title or homebrew.cteston an AMD Radeon 860M,mainac951f8d: 425/426 passed; the failure is #825 (agc_driver_vopc_compare_table, fixed by #1473), which also fails on unmodifiedmainon this GPU.cteston lavapipe (Mesa 26.2.4, selected withVK_DRIVER_FILES), before the rebase ontoac951f8d: 424/424 passed, 22 skipped for its 8-lane subgroups.GraphBuilder.cpp), merge without conflicts with this change. No open PR adds its own copy of these helpers.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-08T11:31:47Z.
Review: APPROVED
Good refactoring that extracts common control flow helper functions into a dedicated header file. This eliminates code duplication across GraphBuilder.cpp, Structurizer.cpp, and ControlFlowGraph.cpp.
Strengths:
This will improve code maintainability by centralizing common control flow utilities. Ready to merge.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T01:03:38Z.
Checked that every removed body is identical to the moved one, only the three control flow sources include the new header, and there is no behaviour change. Built on top of current
mainand ran the AGC/AgcDriver ctest set on Linux: all green. Merges cleanly with #2276, #2257, #2201, #2105 and #1836; CI is green on the head. Merging.