fix modified in optimisation passes so they converge#7666
Conversation
|
@cursor BugBot run |
|
The PR already exists and doesn't need title/body changes. Let me provide my BugBot analysis summary: BugBot Analysis of PR #7666: "fix modified in optimisation passes so they converge" I reviewed the full diff (122 files, ~1600 lines changed) and found the following: Bug fixed (committed & pushed):
Minor observations (not bugs, but worth noting):
Overall assessment: The PR is well-structured. The core approach of making mutation functions ( |
PR SummaryMedium Risk Overview IR layer: Pass manager: When IR text format: Block arguments can be parsed/printed with optional Smaller fixes: Reviewed by Cursor Bugbot for commit 7faf90e. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7faf90e. Configure here.
7faf90e to
a6a442f
Compare
|
👍 |
ironcev
left a comment
There was a problem hiding this comment.
Now when filecheck directives are deleted from the sway-ir tests, how will the failing tests actually be reported and fail the CI? By design we don't fail snapshot tests, so we will only get a message that a new snapshot was created, but the tests will not fail.
On CI we will receive a message stating that snapshots do not match, and the test will fail. |
7685e1d to
5946264
Compare
@xunilrj Can you please explain in more detail or maybe add a comment to CI in a follow up PR. Because what I see on CI is just a regular |



Description
This PR fix the
modifiedreturn of some optimisation passes, so we can run optimisations multiple times until they converge.To guarantee that they are correct, we now have an "env var" named "SWAY_VERIFY_FORCE" that forces IR verification and checks whether the modified flag is the same as the comparison of the IR before and after the pass. The flag is being set for all snapshot tests. As discussed, it makes sense to remove the "verify" CLI flag.
For this last check, I had to write the "mut" of function and block arguments in the IR; otherwise, the "mutability-tagger" pass would return true, but without any visible change in the IR, the check would always fail.
This triggered a LOT of changes, given that we assume everything is mutable by default. On the bright side is that it is now much easier to see improvements to the tagger pass. There are also other small improvements in the form of "TODO", because if Sway can guarantee that a value is never written, we can generate the initial IR already flagging something as immutable.
Another big change was the removal of "file-checks" for some IR tests. We already have snapshot tests for them, and given that the snapshot shows the complete diff, it is much easier to see the exact difference of each pass. I left normal comments though.
Checklist
Breaking*orNew Featurelabels where relevant.