Repository navigation
A local given its own value stores nothing: n = n under -mm=own - #676
Merged
Merged
Conversation
`n = n`, or `n = (n = mk(5), n)`, read the local and stored the value back.
Under own the read counted as moving the value out, so the release of what
the local held came after the move and the program was refused ("used here
after its value was moved"). MLIRGen now emits no store when the value is a
plain read of the same local made in the current block with only reads after
it. This holds in every model - under rc the retain and release it skips were
a pair - and an atomic or volatile local keeps its store.
Test 00self_assign in the corpus (gc, rc, none) and under own.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
An assignment of a local's own value back into it (
n = n, orn = (n = mk(5), n)) now emits no store. This applies in every memory model; under rc, the retain and release it skips cancelled each other out. An atomic or volatile local keeps its store.Why
Under
-mm=own, the store read the value out of the local first, which counted as moving it. The release of what the local held came after that move, so the program was refused: "'this value' is used here after its value was moved" (follow-up 13 from own-raytrace).isSelfStore(MLIRGenImpl.h) matches only a plaints.Loadof the samets.Variableslot, made in the current block with nothing but loads after it, so the slot still holds what was read.Tests
00self_assigncoversn = nfollowed by a move, and the comma form. It is in the corpus (gc, rc, none) and runs under own; without the fix, own rejects it.🤖 Generated with Claude Code