You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some IR tests have a bug: their harness is expecting some passes to return modified = true even when the pass is not modifying anything. To make sure that #7646 is NOT changing the optimisation itself, but only fixing the modified flag, I am creating this PR.
The idea is that #7646 snapshot tests will have only the flag changed, not their optimisation.
Checklist
I have linked to any relevant issues.
I have commented my code, particularly in hard-to-understand areas.
I have updated the documentation where relevant (API docs, the reference, and the Sway book).
Low Risk
Test harness and snapshot files only; compiler optimization logic is not changed in this diff.
Overview
Adds insta snapshot coverage for sway-ir optimization pass tests so each .ir fixture records the pass’s Modified boolean plus a unified before/after IR diff (with ANSI stripped via vte).
The harness in tests.rs now runs only *.ir files, builds that diff with prettydiff, writes *.ir.snap next to the test, and still enforces FileCheck on the optimized IR. A large set of new snapshots under sway-ir/tests/** captures current pass behavior (DCE, inline, mem2reg, demote_*, etc.) as a baseline ahead of fixing incorrect modified reporting.
Minor tooling tweaks: perf-snapshot-historical is enabled on macOS in the justfile, and a trailing newline is fixed on test-forc-fmt-check-panic.
Reviewed by Cursor Bugbot for commit c044fa7. Bugbot is set up for automated code reviews on this repo. Configure here.
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
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.
Description
This PR is a necessary change for #7646.
Some IR tests have a bug: their harness is expecting some passes to return
modified = trueeven when the pass is not modifying anything. To make sure that #7646 is NOT changing the optimisation itself, but only fixing themodifiedflag, I am creating this PR.The idea is that #7646 snapshot tests will have only the flag changed, not their optimisation.
Checklist
Breaking*orNew Featurelabels where relevant.