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): Fix flattening pass inserting loads before stores occur #1783

Merged
merged 1 commit into from
Jun 21, 2023

Conversation

jfecher
Copy link
Contributor

@jfecher jfecher commented Jun 21, 2023

Description

Problem*

Resolves #1756

Summary*

When an allocate instruction occurred in only one branch of an if expression, the flattening pass would still try to create a load instruction before the first store to the allocation in an attempt to save its previous (non-existent) value to merge later. This pass adds a field to track these local allocations and avoid merging stores for them since there is no value to merge in the opposite branch of the if.

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 21, 2023 19:11
Copy link
Collaborator

@ludamad ludamad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but of course Kev has more SSA context

@kevaundray kevaundray added this pull request to the merge queue Jun 21, 2023
Merged via the queue into master with commit 4293b15 Jun 21, 2023
@kevaundray kevaundray deleted the jf/fix-1756 branch June 21, 2023 22:03
This was referenced Jun 21, 2023
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.

CFG flattening pass's reordering of store instructions breaks mem2reg
3 participants