[mono-vm][specializer] Move a fusing operation from lowering to destacking phase#19431
Merged
[mono-vm][specializer] Move a fusing operation from lowering to destacking phase#19431
Conversation
Contributor
Author
This was referenced Apr 13, 2026
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2712de9. Configure here.
03dc67c to
f4f8ba7
Compare
2712de9 to
26e7830
Compare
georgemitenkov
approved these changes
Apr 14, 2026
f4f8ba7 to
50efd4c
Compare
26e7830 to
eca58bf
Compare
This comment was marked as resolved.
This comment was marked as resolved.
eca58bf to
f1e65d0
Compare
17c1c4d to
8e76988
Compare
vgao1996
approved these changes
Apr 20, 2026
calintat
approved these changes
Apr 21, 2026
8e76988 to
2f56ed6
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Contributor
✅ Forge suite
|
Contributor
✅ Forge suite
|
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.


Description
There was a mismatch where cmp+branch fusion was performed, because those micro-ops came later.
In this PR, we move this fusion from lowering to the destacking phase.
It results in fewer stackless exec IR instructions in some cases, and fewer slots (e.g., on the fibonacci example).
How Has This Been Tested?
Existing tests have been upgraded.
Type of Change
Note
Medium Risk
Touches control-flow semantics across IR fusion, lowering, and runtime execution/verification; errors here could miscompile branches or change loop termination behavior despite test updates.
Overview
Moves compare+branch fusion out of lowering and into the destacking/SSA fusion pipeline by introducing
CmpOp, representing comparisons asBinaryOp::Cmp(_), and fusingBinaryOp{Cmp}+BrTrue/BrFalseinto new IR terminatorsBrCmp/BrCmpImm.Updates lowering to consume
BrCmp*directly (and to lower standaloneBrFalse), adding new micro-opsJumpGreaterU64ImmandJumpLessEqualU64Immplus corresponding interpreter, verifier, CFG/gas, and display support. Golden tests are refreshed to reflect fewer temporary slots and newly-lowered control-flow cases that were previously skipped.Reviewed by Cursor Bugbot for commit 2f56ed6. Bugbot is set up for automated code reviews on this repo. Configure here.