-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[MoveChecker] Distinguished scope end diagnostics. #71162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
nate-chandler
merged 12 commits into
swiftlang:main
from
nate-chandler:partial-consumption/20240125/1/scope-end-diagnostic
Jan 30, 2024
Merged
[MoveChecker] Distinguished scope end diagnostics. #71162
nate-chandler
merged 12 commits into
swiftlang:main
from
nate-chandler:partial-consumption/20240125/1/scope-end-diagnostic
Jan 30, 2024
Conversation
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
@swift-ci please test |
The version for Value and Instruction are identical except for the type of the source of the cast to SILNode. Add an overload for SILNode through which the other two call.
Whether a node is a def on a collection of bits (whether a range or a bit vector) isn't exhaustively characterized by the values {true, false}. A node may be a def on some but not others of the bits in the collection. Changed the range-taking isDef to write back the bits in the range at which the node is a def. The caller can then decide how to react with full information.
Add a new SILNode taking overload and change the SILInstruction and SILValue taking overloads to call it.
Exited early.
Simplified diagnostic emission to use a single code path.
There are several kinds of scopes at which it is required that an address be initialized: (1) the whole function -- for inout argument to the function (2) the region a coroutine is active -- for an inout yielded by a coroutine into the function (3) the region of a memory access -- for a `begin_access [modify]`. The move checker enforces that they are initialized at that point by adding instructions at which the field must be live to liveness. Previously, all such scopes used the end of the function as the point at which the memory had to have been reinitialized. Here, the relevant end of scope markers are used instead. More importantly, here the diagnostic is made to vary--the diagnostic, that is, that is issued in the face an address not being initialized at the end of these different kind of scopes.
Use the same code path to add users at which an address must have been reinitialized for both kinds of mark_unresolved_non_copyable_value which permit assignment.
When extending liveness, the instructions prior to a preexisting destroy are added to liveness. If that prior instruction is the def, adding it to liveness results in multi-def liveness understanding that there is a prior def. Fixes a bug exposed by adding coroutine ends to liveness rather than function ends.
ab9dafd
to
bff7618
Compare
@swift-ci please test |
@swift-ci please test source compatibility |
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.
There are several kinds of scopes at which it is required that an address be initialized:
(1) the whole function -- for inout argument to the function
(2) the region a coroutine is active -- for an inout yielded by a coroutine into the function
(3) the region of a memory access -- for a
begin_access [modify]
.The move checker enforces that they are initialized at that point by adding instructions at which the field must be live to liveness.
Previously, all such scopes used the end of the function as the point at which the memory had to have been reinitialized. Here, the relevant end of scope markers are used instead.
More importantly, here the diagnostic is made to vary--the diagnostic, that is, that is issued in the face an address not being initialized at the end of these different kind of scopes.