Repository navigation
refactor(recompiler): share the control flow helpers - #1493
Merged
adriadam10 merged 1 commit intoOct 10, 2026
Merged
Conversation
toHexString, contains, intersectSorted, addUnique, sortUnique, remapId, remapIds and rebuildPredecessors were defined with identical bodies in the anonymous namespaces of two of ControlFlowGraph.cpp, GraphBuilder.cpp and Structurizer.cpp. They are now declared in ControlFlowHelpers.hpp, which only these three files include, and defined in ControlFlowGraph.cpp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
klosixgaming-arch
approved these changes
Oct 8, 2026
klosixgaming-arch
left a comment
Contributor
There was a problem hiding this comment.
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:
- Clean separation of concerns with dedicated helper functions (toHexString, contains, intersectSorted, addUnique, sortUnique, remapId, remapIds, rebuildPredecessors)
- Proper use of existing standard library algorithms
- No behavioral changes, just code organization improvement
- Good header file design with appropriate includes
This will improve code maintainability by centralizing common control flow utilities. Ready to merge.
9 tasks done
Collaborator
|
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 |
SleglJan
pushed a commit
to SleglJan/AnyPS5
that referenced
this pull request
Oct 10, 2026
…low-shared-helpers refactor(recompiler): share the control flow helpers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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,mainac951f8: 425/426 passed; the failure is agc_driver_vopc_compare_table fails in wave32 for LG compares in the e32 encoding on AMD RDNA 3.5 #825 (agc_driver_vopc_compare_table, fixed by fix(shader): emit ordered not-equal through an integer NaN check #1473), which also fails on unmodifiedmainon this GPU.cteston lavapipe (Mesa 26.2.4, selected withVK_DRIVER_FILES), before the rebase onto ac951f8: 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