Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Problem*
Resolves
Summary*
Cleans up the mem2reg pass a bit by adding a wrapper type for
AliasSet
s and putting types in different modules.Compared to the old
BTreeMap<ValueId, ReferenceValue>
, the newAliasSet
makes it harder to accidentally handle unifying zero values as a set union (A U {} = A
) instead of the correctA 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 anOption<BTreeMap<...>>
internally instead.Documentation
This PR requires documentation updates when merged.
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*
cargo fmt
on default settings.