Skip to content

fix: Implement new mem2reg pass#2420

Merged
kevaundray merged 18 commits intomasterfrom
jf/new-mem2reg
Aug 25, 2023
Merged

fix: Implement new mem2reg pass#2420
kevaundray merged 18 commits intomasterfrom
jf/new-mem2reg

Conversation

@jfecher
Copy link
Contributor

@jfecher jfecher commented Aug 23, 2023

Description

Problem*

Resolves #2406
Resolves #2316
Resolves #2417

Summary*

Overhauls the mem2reg pass in the SSA to handle function calls and aliases.

There are some TODOs as part of this PR - I do not plan on implementing these as part of the PR and will create issues for them tomorrow. Most notable of them is that aliases within array values are not tracked.

I still need to write more documentation for this pass as well. It is missing much of the overall pass architecture documentation from the hackmd document linked in the issue. This PR is also currently missing additional test cases for the new features.

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

Note that in some tests, the expected number of stores that are removed has changed. The new pass will keep each store that is still possibly used as well as the final store in each block. This is because the final store may still be needed when another block is branched to afterward.

PR Checklist*

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

@jfecher
Copy link
Contributor Author

jfecher commented Aug 24, 2023

This PR is ready for review

Copy link
Contributor

@vezenovm vezenovm left a comment

Choose a reason for hiding this comment

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

Nice, the documentation and code reads well. Mainly a couple nits and questions

jfecher and others added 6 commits August 25, 2023 12:30
Copy link
Contributor

@vezenovm vezenovm left a comment

Choose a reason for hiding this comment

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

LGTM

@kevaundray kevaundray added this pull request to the merge queue Aug 25, 2023
Merged via the queue into master with commit 7714cd0 Aug 25, 2023
@kevaundray kevaundray deleted the jf/new-mem2reg branch August 25, 2023 18:42
TomAFrench added a commit that referenced this pull request Aug 25, 2023
* master:
  fix: Implement new mem2reg pass (#2420)
  feat(nargo): Support optional directory in git dependencies (#2436)
  fix(acir_gen): Pass accurate contents to slice inputs for bb func calls (#2435)
  fix(ssa): codegen missing check for unary minus (#2413)
  fix(lsp): Remove duplicated creation of lenses (#2433)
  feat: Add `test(should_fail)` attribute for tests that are meant to fail (#2418)
  chore: improve error message for InternalError (#2429)
  chore: Add stdlib to every crate as it is added to graph (#2392)
jfecher pushed a commit that referenced this pull request Aug 28, 2023
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants