-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SendNonSendable] Diagnose consumption sites not requirement sites #67318
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
Conversation
…cesses to consumed values
@swift-ci please smoke test |
@@ -196,7 +211,7 @@ class Partition { | |||
return; | |||
canonical = true; | |||
|
|||
std::map<signed, unsigned> relabel; | |||
std::map<unsigned, unsigned> relabel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh no now I can't tell what this means at all. can your next PR at least include those typealiases for unsigned
and signed
to give them a better name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, performing this refactor!
enum class LocalConsumedReasonKind { | ||
LocalConsumeInst, | ||
LocalNonConsumeInst, | ||
NonLocal | ||
}; | ||
|
||
// Why was a value consumed, without looking across blocks? | ||
// kind == LocalConsumeInst: a consume instruction in this block | ||
// kind == LocalNonConsumeInst: an instruction besides a consume instruction | ||
// in this block | ||
// kind == NonLocal: an instruction outside this block |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good to move these explainer comments directly onto the LocalConsumedReasonKind
cases instead of on top of the struct containing it so it shows up in IDE documentation windows for what LocalConsumedReasonKind::X
means.
test/Concurrency/DeferredSendableChecking/region_based_sendability.swift
Show resolved
Hide resolved
@swift-ci please smoke test |
1 similar comment
@swift-ci please smoke test |
…ions, and ensure that all SILValues are converted once to TrackableSILValues in the SendNonSendable analysis pass
@swift-ci please smoke test |
@swift-ci please smoke test |
…in improving diagnostic messages
@swift-ci please smoke test |
In prior versions of the SendNonSendable pass, diagnostics were reported when it was discovered that a value in a consumed region was accessed. This is confusing as the site that performed the consumption is the site that actually invoked a cross-isolation call or other concurrency primitive. This PR changes the behavior to instead search for the site at which an original consumption took place, and diagnose that site along with notes of some potential accesses.