[ownership] Refactor linear lifetime checker so that it doesnt requir… #26767
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.
…e a value (only a beginBlock).
NFCI.
The checker internally doesn't actually use the value for anything except for
diagnostics and getting the value's parent block. So what this commit does is
change the value to be optional state that is used in the diagnostics if it is
available and otherwise uses its own ptr to the beginBlock. This will allow me
to make two different constructors, one that takes a value (and sets the
beginBlock ptr to its own parent block) and one that just takes a block. In
certain cases, basing it off of the value can lead to counter-intuitive bugs
(esp if code is using Builder.emit*ValueOperation() to create retain/release in
non-ossa code).
The reason why I am doing this is I want to introduce a higher level API on top
of this for a common pattern in ossa (and code written for both modes): lifetime
extending a value from a use point to a later program point by using a copy. I
will explain this in more detail in a forthcoming commit.