Skip to content

Remove obsolete CFEI/CFSI optimization from ASM generation - #7721

Merged
ironcev merged 1 commit into
masterfrom
ironcev/remove-misplaced-cfei-cfsi-optimization
Aug 26, 2026
Merged

Remove obsolete CFEI/CFSI optimization from ASM generation#7721
ironcev merged 1 commit into
masterfrom
ironcev/remove-misplaced-cfei-cfsi-optimization

Conversation

@ironcev

@ironcev ironcev commented Aug 26, 2026

Copy link
Copy Markdown
Member

Description

This PR:

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).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@cursor

cursor Bot commented Aug 26, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes compiler bytecode layout and jump-offset accounting, but behavior should stay equivalent because zero stack ops are still removed earlier in the allocated-abstract pipeline; regressions would show up as wrong jumps or VM failures.

Overview
Removes redundant zero-size CFEI/CFSI handling from bytecode emission and instruction-size math, so stripping those ops happens only in AllocatedAbstractInstructionSet::remove_redundant_ops (and related stack optimizations) instead of also in to_fuel_asm and jump/offset sizing.

Globals prologue: append_globals_allocation no longer inserts CFEI when the globals section is empty, which drops the former cfei i0 ; allocate stack space for globals from script entry prologues.

Offset helpers (op_size_in_bytes, worst_case_instruction_size, instruction_size_not_far_jump) now treat CFEI/CFSI like normal 4-byte ops because zero-immediate forms should not reach those paths. E2E ASM snapshots are updated accordingly.

Reviewed by Cursor Bugbot for commit 90e73d0. Bugbot is set up for automated code reviews on this repo. Configure here.

@ironcev
ironcev deployed to fuel-sway-bot August 26, 2026 11:29 — with GitHub Actions Active
@ironcev ironcev self-assigned this Aug 26, 2026
@ironcev ironcev added compiler General compiler. Should eventually become more specific as the issue is triaged compiler: codegen Everything to do with IR->ASM, register allocation, etc. labels Aug 26, 2026
@ironcev

ironcev commented Aug 26, 2026

Copy link
Copy Markdown
Member Author

👍

@codspeed-hq

codspeed-hq Bot commented Aug 26, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 25 untouched benchmarks


Comparing ironcev/remove-misplaced-cfei-cfsi-optimization (90e73d0) with master (08dad8c)

Open in CodSpeed

@ironcev
ironcev marked this pull request as ready for review August 26, 2026 11:55
@ironcev
ironcev requested a review from a team as a code owner August 26, 2026 11:55
@ironcev
ironcev enabled auto-merge (squash) August 26, 2026 11:55
Comment thread sway-core/src/asm_lang/allocated_ops.rs
@ironcev
ironcev merged commit f6f97f0 into master Aug 26, 2026
43 checks passed
@ironcev
ironcev deleted the ironcev/remove-misplaced-cfei-cfsi-optimization branch August 26, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler: codegen Everything to do with IR->ASM, register allocation, etc. compiler General compiler. Should eventually become more specific as the issue is triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants