Fix IRList::structural_equals to ignore MFLOW_FALLTHROUGH - #997
Open
rootkiller6788 wants to merge 2 commits into
Open
Fix IRList::structural_equals to ignore MFLOW_FALLTHROUGH#997rootkiller6788 wants to merge 2 commits into
rootkiller6788 wants to merge 2 commits into
Conversation
structural_equals compared every entry in the IR lists, including MFLOW_FALLTHROUGH no-ops. Two methods that differ only by a no-op placement (e.g. one has an unreferenced label lowered to FALLTHROUGH) were reported as not structurally equal. Trailing metadata/no-op entries after the last real instruction also caused a mismatch when the other list had already been fully consumed. Skip metadata and FALLTHROUGH entries on both sides before each comparison step, and skip any remaining trailing no-ops after the main loop. Add unit tests covering leading and trailing FALLTHROUGH entries. Closes facebook#778
structural_equals is a const method, so m_list.begin() and other.begin() return IRList::const_iterator. The skip_noops lambda declared its first parameter as IRList::iterator&, so the calls at the top of the loop did not match (no known conversion from const_iterator to iterator&), which broke the build on GCC (both linux and windows). Use IRList::const_iterator& for the iterator parameter so the lambda accepts the iterators that a const comparison actually works with.
Contributor
Author
|
Hi, thanks for the feedback! This PR makes Could you please re-run the CI / take another look? Thanks! |
rootkiller6788
marked this pull request as ready for review
August 27, 2026 18:05
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.
Fixes #778
IRList::structural_equalscompared every entry in the IR lists, includingMFLOW_FALLTHROUGHno-ops, so two methods that differ only in the placement of a no-op (e.g. an unreferenced label lowered to FALLTHROUGH) were reported as not structurally equal. Trailing metadata/no-op entries after the last real instruction also caused a mismatch when the other list had already been fully consumed.This change skips metadata and FALLTHROUGH entries on both sides before each comparison step, and skips any remaining trailing no-ops after the main loop. Unit tests are added for leading and trailing FALLTHROUGH entries, plus a negative case ensuring real differences are still detected.