Skip to content

codegen optimization: constant expression folding #7149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 43 commits into
base: master
Choose a base branch
from

Conversation

Dentosal
Copy link
Member

@Dentosal Dentosal commented May 5, 2025

Description

Follow-up to #7109. Adds support to propagating and folding expressions in the fuel-vm codegen stage.

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.

@Dentosal Dentosal self-assigned this May 5, 2025
@Dentosal Dentosal temporarily deployed to fuel-sway-bot May 5, 2025 08:09 — with GitHub Actions Inactive
Copy link

codspeed-hq bot commented May 5, 2025

CodSpeed Performance Report

Merging #7149 will not alter performance

Comparing dento/asm-gen-opt-2 (a762ce1) with master (a428376)

Summary

✅ 23 untouched benchmarks

@Dentosal Dentosal temporarily deployed to fuel-sway-bot May 12, 2025 10:13 — with GitHub Actions Inactive
@Dentosal Dentosal temporarily deployed to fuel-sway-bot May 12, 2025 10:56 — with GitHub Actions Inactive
@Dentosal Dentosal temporarily deployed to fuel-sway-bot May 19, 2025 05:50 — with GitHub Actions Inactive
@Dentosal Dentosal temporarily deployed to fuel-sway-bot May 19, 2025 06:10 — with GitHub Actions Inactive
@Dentosal Dentosal temporarily deployed to fuel-sway-bot May 19, 2025 06:23 — with GitHub Actions Inactive
@Dentosal Dentosal temporarily deployed to fuel-sway-bot May 19, 2025 06:45 — with GitHub Actions Inactive
@Dentosal Dentosal temporarily deployed to fuel-sway-bot May 19, 2025 07:05 — with GitHub Actions Inactive
@Dentosal Dentosal temporarily deployed to fuel-sway-bot May 19, 2025 08:19 — with GitHub Actions Inactive
@Dentosal Dentosal temporarily deployed to fuel-sway-bot May 19, 2025 09:14 — with GitHub Actions Inactive
@Dentosal Dentosal temporarily deployed to fuel-sway-bot May 19, 2025 09:25 — with GitHub Actions Inactive
@Dentosal Dentosal temporarily deployed to fuel-sway-bot May 19, 2025 14:10 — with GitHub Actions Inactive
@Dentosal
Copy link
Member Author

With these optimizations enalbed, it's possible to hit a pre-existing bug which causes compiler panic. The should_fail/arith_overflow/u64_mul_overflow test from (cargo run --locked --bin test -- --locked --release) hits this. The multiplication in const_indexing_aggregates_function overflows, and compiler panics:

.insert(dest.clone(), RegContents::Constant(c1 * c2));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant