-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[5.9][move-only] When adding implicit liveness uses for class field/global accesses, do not use the terminator, use the end access. #67089
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
[5.9][move-only] When adding implicit liveness uses for class field/global accesses, do not use the terminator, use the end access. #67089
Conversation
@swift-ci test |
I tried the new
|
…r to bisect on variables that we are checking. These are only on in NDEBUG mode. It just makes it easier to quickly triage which variable is causing a checking problem. (cherry picked from commit fb487bf)
… accesses, do not use the terminator, use the end access. Previously, when doing this I could just use the terminator both in cases of inout and for class field/global accesses... but after some recent changes to field sensitive pruned liveness, this seems to no longer work. So just do the right thing and use the field access. The specific bug was that we would introduce a destroy_addr along one of the paths where the value wasn't defined resulting in a dominance error. I added a SIL test that shows this fixes the issue, a swift test, and also an Interpreter test that validates the correctness. rdar://111659649 (cherry picked from commit 7028381)
…ble_but_not_consumable -> initable_but_not_consumable. I fixed this for assign but missed a place where we needed to do the same thing for copy_addr. rdar://111709236 (cherry picked from commit 0e383cd)
Both of the previous fixes in this PR were found via this test. (cherry picked from commit 268cd76)
@nate-chandler Ok, I could be wrong. My assumption was that it was something related to maximizing lifetime or field sensitive pruned liveness. Regardless, this needs to be fixed. |
0ca0cae
to
a53cdb0
Compare
@swift-ci test |
As part of testing this, I discovered another issue in DI that is tied a little to this, so I am going to CCC them together. |
@swift-ci test macOS platform |
This PR contains two different, but related changes. I am going to CCC them together since the changes were both found while fixing the same test that I am uploading here.
• Description: [5.9][move-only] When adding implicit liveness uses for class field/global accesses, do not use the terminator, use the end access. The language impact is that we miscompile this type of code:
In words, we miscompile a place where we conditionally apply an assign. The result is that we insert a destroy_addr on the value before we do the assign, causing us to destroy the original value before we do the actual assign.
• Risk: This is low risk since it only affects a corner case in a specific part of the noncopyable checker. So it cannot affect anything but noncopyable code.
• Original PR: #67088
• Reviewed By: @jckarter
• Testing: Added SIL/Swift/Interpreter tests to validate the behavior. (The interpreter test is moveonly_linkedlist.swift which I included in the last cherry-picked commit since the next commit is also needed for it).
• Resolves: rdar://111659649
• Description: [move-only] Fix a place in DI where we were not converting an assignable_but_not_consumable -> initable_but_not_consumable. I fixed this for assign but missed a place where we needed to do the same thing for copy_addr. The language impact of this change is that we miscompile initializations of generic types in certain specific cases like in moveonly_linkedlist.swift:12.
• Risk: This is low risk since it only affects a corner case in DefiniteInitialization that only applies to noncopyable code. So it cannot affect anything but noncopyable code.
• Original PR: #67088
• Reviewed By: @jckarter
• Testing: Added a SIL/Swift/Interpreter tests to validate the behavior. (The interpreter test is moveonly_linkedlist.swift)
• Resolves: rdar://111709236