-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Fix the IR attributes of swift_getObjectType. #13390
Conversation
It's not readnone, because it reads the metatype from an object. Readnone would let the llvm ARC optimizer reschedule the call with a release-call for the object. fixes SR-6560.
@swift-ci 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.
Your reasoning seems sound. Essentially, anything that depends on object liveness can be thought of as reading the reference count of those objects.
Build failed |
Build failed |
@swift-ci test |
If only we had a notion of "this can be done earlier, but not later". |
@swift-ci nominate • Explanation: Fixes a use-after-free issue related to class types |
I'm not opposed to the conservative fix, but it does indicate a problem or deficiency in the LLVM ARC pass. Reference counts are part of the "runtime memory", so LLVM doesn't see them. Any pass that reorders runtime calls needs a different interpretation of the memory effects. |
Any LLVM pass could reorder this operations if the function is marked as readnone. |
It's not readnone, because it reads the metatype from an object.
Readnone would let the llvm ARC optimizer reschedule the call with a release-call for the object.
fixes SR-6560.
rdar://problem/35998785