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

fix(ssa refactor): Prevent stores in 'then' branch from affecting the 'else' branch #1827

Merged
merged 3 commits into from
Jun 26, 2023

Conversation

jfecher
Copy link
Contributor

@jfecher jfecher commented Jun 26, 2023

Description

Problem*

Resolves #1826

Summary*

Previously, any stores in the then branch of an if would be picked up by the else branch as well (See the linked issue for more details). This PR adds an extra step to the flattening pass to restore the old values of each store between the then and else branches to fix this.

I've also altered the merge_stores_with_offset test since we no longer support offsets from allocations after the switch to immutable arrays. I changed the test to a simple merge stores test but with an else block.

Documentation

  • This PR requires documentation updates when merged.

    • I will submit a noir-lang/docs PR.
    • I will request for and support Dev Rel's help in documenting this PR.

Additional Context

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@jfecher jfecher requested a review from kevaundray June 26, 2023 19:47
@kevaundray kevaundray enabled auto-merge June 26, 2023 20:17
@kevaundray kevaundray added this pull request to the merge queue Jun 26, 2023
Merged via the queue into master with commit e068fd4 Jun 26, 2023
@kevaundray kevaundray deleted the jf/fix-stores branch June 26, 2023 20:58
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.

else branch of an if uses the stores from the then branch
2 participants