-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[ownership] Replace all uses outside of the SILOwnershipVerifier of LinearLifetimeChecker::checkValue() and make it a private implementation detail. #30602
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
@swift-ci smoke test |
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.
lgtm, but I still don't understand what scratch
is for, and it's strange that consumingUse can only be a single use.
…inearLifetimeChecker::checkValue() and make it a private implementation detail. HOW THIS WAS DONE: I did this by refactoring the last usages of checkValue into a higher level API that uses checkValue as an implementation detail: completeConsumingUseSet(...). All of these places in MandatoryInlining/PredictableMemOpts all wanted behavior where we complete a set of consuming uses for a value, detecting if the consuming use is in a different loop nest from the value. WHY DO THIS: The reason why I wanted to do this is that checkValue is a lower level API that drives the actual low level computation. We shouldn't expose its interface to the LinearLifetimeChecker's users since it is our own private implementation detail that also has some sharp edges. AN ADDITIONAL BENEFIT: Additionally by hiding the declaration of checkValue, the last public use of LinearLifetimeError and ErrorBehaviorKind was not private. This allowed me to then move the declarations of those two to a private header (./lib/SIL/LinearLifetimeCheckerPrivate.h) and make their declarations private to LinearLifetimeChecker as well. As such, I renamed them to LinearLifetimeChecker::Error and LinearLifetimeChecker::ErrorBehaviorKind.
b061d92
to
84232cf
Compare
@swift-ci test |
Build failed |
Build failed |
@swift-ci test OS X platform |
@swift-ci test linux platform |
@swift-ci test OS X platform |
HOW THIS WAS DONE: I did this by refactoring the last usages of checkValue into
a higher level API that uses checkValue as an implementation detail:
completeConsumingUseSet(...). All of these places in
MandatoryInlining/PredictableMemOpts all wanted behavior where we complete a set
of consuming uses for a value, detecting if the consuming use is in a different
loop nest from the value.
WHY DO THIS: The reason why I wanted to do this is that checkValue is a lower
level API that drives the actual low level computation. We shouldn't expose its
interface to the LinearLifetimeChecker's users since it is our own private
implementation detail that also has some sharp edges.
AN ADDITIONAL BENEFIT: Additionally by hiding the declaration of checkValue, the
last public use of LinearLifetimeError and ErrorBehaviorKind was not
private. This allowed me to then move the declarations of those two to a private
header (./lib/SIL/LinearLifetimeCheckerPrivate.h) and make their declarations
private to LinearLifetimeChecker as well. As such, I renamed them to
LinearLifetimeChecker::Error and LinearLifetimeChecker::ErrorBehaviorKind.