-
Notifications
You must be signed in to change notification settings - Fork 10.5k
early exit in TypeLowering for address-only type #1253
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
early exit in TypeLowering for address-only type #1253
Conversation
for (auto eltType : type.getElementTypes()) { | ||
switch (classifyType(eltType, M, Sig, Expansion)) { | ||
case LoweredTypeKind::Trivial: | ||
continue; | ||
case LoweredTypeKind::AddressOnly: | ||
isAddressOnly = true; | ||
return asImpl().handleAddressOnly(type); | ||
continue; |
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.
The 'continue' is unreachable now
Awesome, thank you so much! |
The logic that detects type circularity in TypeLowering has been replaced in Sema. By exiting as soon as an address-only type is detected, we can avoid walking the rest and gain some speedup.
bf269de
to
9203f20
Compare
@slavapestov updated. |
RecursiveErrorTypeLowering(SILType type) | ||
: AddressOnlyTypeLowering(type) {} | ||
|
||
bool isValid() const override { |
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.
One more nit-pick if you don't mind: It looks like TypeLowering::isValid() is never called anywhere and always returns true now, so it can be removed?
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.
It is used in lib/SILOptimizer/Mandatory/PredictableMemOpt.cpp#44, but since it's alway true, we can remove that check now. Right?
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.
I believe that check was added since we still run mandatory optimizations even if SILGen generated diagnostics.
So yeah, go ahead and remove it!
@swift-ci Please test |
Alright, looks good. I'll merge once CI is done. |
@swift-ci Please test |
Thanks! |
early exit in TypeLowering for address-only type
Test SwiftPM included in the distribution on CI
The logic that detects type circularity in TypeLowering has been replaced in
Sema. By exiting as soon as an address-only type is detected, we can avoid
walking the rest and gain some speedup.