6.0: [MoveOnlyAddressChecker] Exclusivity handles DeadEnds. #75408
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.
Explanation: Handle incomplete access scopes when diagnosing exclusivity issues.
The move-only address checker diagnoses exclusivity violations by checking whether consuming uses occur within an access scope (marked by one
begin_access
instruction and some number ofend_access
instructions). Specifically, it checks whether instructions that consume a value occur within the scope. If they do not, it emits an error.In dead-end regions of a function (those from which there are no function exiting paths), special care must be taken when determining whether an instruction is live when the value which defines the region does not have a "complete lifetime" (a consuming use on every path). Access scopes do not always have complete lifetimes, so they need this special care. To get this special care, an instance of
DeadEndBlocks
must be passed toPrunedLiveness
. (At the moment, it is also necessary to callareUsesWithinBoundary
instead ofisWithinBoundary
, but that is only temporary.)Here, the
DeadEndBlocks
instance is threaded a bit farther into the checker so that it can be passed along toPrunedLiveness
.The result is that consumes in dead-end blocks are correctly understood to be within the access scope when there is no
end_access
in that dead-end region.Scope: Affects noncopyable code.
Issue: rdar://131960619
Original PR: #75404
Risk: Low. Amounts to passing an additional argument down in order to have an additional way to determine that an instruction is within a boundary. Furthermore, only affects the diagnostic relating to exclusivity emitted by the checker.
Testing: Added test.
Reviewer: Kavon Farvardin ( @kavon ), Joe Groff ( @jckarter )