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

mem2reg ignores terminator #1502

Closed
Tracked by #1376
joss-aztec opened this issue Jun 2, 2023 · 0 comments · Fixed by #1504
Closed
Tracked by #1376

mem2reg ignores terminator #1502

joss-aztec opened this issue Jun 2, 2023 · 0 comments · Fixed by #1504
Assignees
Labels
bug Something isn't working refactor ssa

Comments

@joss-aztec
Copy link
Contributor

Aim

SSA store/load instructions to a reference appearing in a return terminator should be preserved.

Expected Behavior

fn main(x : Field) -> pub [Field; 2] {
    [x, x]
}

should produce a valid program

Bug

Last two SSA pass ouputs

After Flattening:
fn main f1 {
  b0(v0: Field):
    v1 = alloc 2 fields
    store v0 at v1
    v3 = add v1, Field 1
    store v0 at v3
    return v1
}

After Mem2Reg:
fn main f1 {
  b0(v0: Field):
    v1 = alloc 2 fields
    v3 = add v1, Field 1
    return v1
}

Notice both stores have been removed

To Reproduce

Installation Method

None

Nargo Version

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@joss-aztec joss-aztec added bug Something isn't working refactor ssa labels Jun 2, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Jun 2, 2023
@joss-aztec joss-aztec self-assigned this Jun 2, 2023
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working refactor ssa
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant