-
Notifications
You must be signed in to change notification settings - Fork 10.5k
IRGen: don't create ObjC methods with the unnamed_addr attribute #29188
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 test |
@swift-ci benchmark |
Performance: -O
Code size: -OPerformance: -Osize
Code size: -OsizePerformance: -Onone
Code size: -swiftlibsHow to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
Build failed |
@swift-ci test macOS |
1 similar comment
@swift-ci test macOS |
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.
Maybe in a follow-up can you add a comment reminding us in the future to not do this again?
test/IRGen/objc_bridge.swift
Outdated
@@ -130,57 +130,57 @@ var NSS : NSString = NSString() | |||
|
|||
// -- NSString methods don't convert 'self' | |||
extension NSString { | |||
// CHECK: define internal [[OPAQUE:.*]]* @"$sSo8NSStringC11objc_bridgeE13nsstrFakePropABvgTo"([[OPAQUE:.*]]*, i8*) unnamed_addr | |||
// CHECK: define internal void @"$sSo8NSStringC11objc_bridgeE13nsstrFakePropABvsTo"([[OPAQUE:.*]]*, i8*, [[OPAQUE:.*]]*) unnamed_addr | |||
// CHECK: define internal [[OPAQUE:.*]]* @"$sSo8NSStringC11objc_bridgeE13nsstrFakePropABvgTo"([[OPAQUE:.*]]*, i8*) |
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.
Could you add:
CHECK-SAME-NOT: unnamed_addr
here and the other locations where it was 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.
Good point. I'll add a regexp at the end of the line so that unnamed_addr is not matched.
This seems like an unfortunate blanket policy. Do we know what Foundation is using the imp pointers for? Is it for an isolated enough set of cases that we could special case them instead of eliminating this optimization for all ObjC entry points? |
In some places, Foundation is comparing ObjC method pointers. Therefore LLVM's function merging pass must not create aliases for identica; functions, but instead create thunks. This can be ensured by not creating ObjC methods with the unnamed_addr attribute. rdar://problem/58483698
4fc5583
to
f7d610d
Compare
@jckarter It's used in Foundation to check if a method has an override. I'm not sure if there are more cases. Anyway, I think we doesn't harm to be on the safe side here. I don't think this attribute has a significant performance/code-size effect (for objc methods). |
@swift-ci smoke test |
In some places, Foundation is comparing ObjC method pointers.
Therefore LLVM's function merging pass must not create aliases for identica; functions, but instead create thunks.
This can be ensured by not creating ObjC methods with the unnamed_addr attribute.
rdar://problem/58483698