Skip to content
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

Properly treat FuelVMInstructions in the memcpyopt #6650

Merged
merged 3 commits into from
Oct 16, 2024

Conversation

ironcev
Copy link
Member

@ironcev ironcev commented Oct 16, 2024

Description

This PR fixes the issue of FuelVMInstructions not being considered in the memcpyopt as storing into the destination. E.g., in this example:

script {
    entry fn main() -> u256 {
        local u256 x
        local u256 y
        local u256 z

        entry():
        v0 = get_local ptr u256, x
        v1 = get_local ptr u256, y
        v2 = get_local ptr u256, z

        mem_copy_val v2, v0
        wide add v0, v1 to v2
        v3 = load v2

        ret u256 v3
    }
}

after the memcpyopt the v3 = load v2 got turned into v3 = load v0 because the v2 is considered as not being written to.

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.

vaivaswatha
vaivaswatha previously approved these changes Oct 16, 2024
@ironcev ironcev marked this pull request as ready for review October 16, 2024 10:34
@ironcev ironcev requested a review from a team as a code owner October 16, 2024 10:34
@ironcev ironcev changed the title Kill defined symbols if they are a result of a FuelVM wide operator Properly treat FuelVMInstructions in the memcpyopt Oct 16, 2024
@ironcev ironcev self-assigned this Oct 16, 2024
@ironcev ironcev added bug Something isn't working compiler General compiler. Should eventually become more specific as the issue is triaged compiler: ir IRgen and sway-ir including optimization passes labels Oct 16, 2024
@ironcev ironcev requested a review from a team October 16, 2024 10:38
@ironcev ironcev merged commit b7dde28 into master Oct 16, 2024
38 checks passed
@ironcev ironcev deleted the ironcev/memcpyopt-discard-cache branch October 16, 2024 10:57
JoshuaBatty added a commit that referenced this pull request Oct 16, 2024
## Description
waiting on

~~#6645~~
~~#6647~~ 
~~#6649~~ 
~~#6650~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler: ir IRgen and sway-ir including optimization passes 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.

3 participants