[SIL] Add a "unique" flag to alloc_ref instructions. #32844
Closed
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.
Adds a new flag to alloc_ref instructions. This flag, "unique",
signifies that the reference is unique meaning it is not stored
elsewhere and may not be written to elsewhere. This means accesses of
this reference may be "static" instead of "dynamic".
The uniqueness of the reference is enforced by the SILVerifier. This is good
because it may be run between each pass so errors will be easy to track
down.
Currently, the SILVerifier only supports a very few cases where it can
prove uniqueness, all other cases will end in an error. Later this
verifier check may be extended to be more robust.
Currently, the only way to mark a reference as unique is through textual
SIL. Later optimization passes may be added or updated to add this
information.
Forum post here. Refs #31423.