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

chore: Cleanup mem2reg pass #2531

Merged
merged 3 commits into from
Sep 5, 2023
Merged

chore: Cleanup mem2reg pass #2531

merged 3 commits into from
Sep 5, 2023

Conversation

jfecher
Copy link
Contributor

@jfecher jfecher commented Sep 1, 2023

Description

Problem*

Resolves

Summary*

Cleans up the mem2reg pass a bit by adding a wrapper type for AliasSets and putting types in different modules.

Compared to the old BTreeMap<ValueId, ReferenceValue>, the new AliasSet makes it harder to accidentally handle unifying zero values as a set union (A U {} = A) instead of the correct A U {} = {}. In addition, it turns out an original assumption that a value will never be known to have exactly 0 aliases was incorrect. This can happen if we have an empty array of references. The array is empty, so although it has reference-typed elements, we know it does not actually alias anything at all. This means alias sets can no longer use an empty btree to represent the unknown case. It is now represented as an Option<BTreeMap<...>> internally instead.

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

I was working on some other PRs including #2494 and an addition to handle SlicePushBack and friends, and found it useful to break out this change into another PR.

I'm also unable to run cargo t currently (see slack) as I'm getting base64 errors, so I've no idea if this PR is passing or not.

PR Checklist*

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

@jfecher jfecher added this pull request to the merge queue Sep 5, 2023
Merged via the queue into master with commit 8af53bf Sep 5, 2023
14 checks passed
@jfecher jfecher deleted the jf/mem2reg-array-update branch September 5, 2023 17:20
TomAFrench added a commit that referenced this pull request Sep 5, 2023
* master:
  fix(aztec): fix compilation of `aztec_library.rs` (#2567)
  feat(ssa): Replace values which have previously been constrained with simplified value (#2483)
  fix: Black box func slice handling (#2562)
  chore: Temporarily disable `noir_wasm` test (#2566)
  fix: Make def collector ordering more deterministic (#2515)
  chore: refactor `constant_folding` pass (#2533)
  chore: Cleanup mem2reg pass (#2531)
  chore: Replace hashers of hashmaps in dfg with fxhashes (#2490)
  chore: remove duplicate span from FunctionReturnType (#2546)
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.

2 participants