Skip to content

[4.1][sil] When expanding aggregate instructions, do so consistently based… #14163

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

Merged

Conversation

gottesmm
Copy link
Contributor

… off the code-size hueristic.

We were expanding retain_value, release_value properly, but not
copy_addr/destroy_addr. This caused ARC invariants to break resulting in
miscompiles.

rdar://36509461

@gottesmm gottesmm force-pushed the swift-4.1-branch_rdar36509461 branch from a4e30df to 6ca0f7a Compare January 25, 2018 19:20
@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm gottesmm requested a review from shajrawi January 25, 2018 20:01
Copy link

@shajrawi shajrawi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include/swift/SIL/TypeLowering.h: static TypeExpansionKind getLoweringStyle(bool shouldExpand) { is no longer used after this change, can you please remove said function? Otherwise LGTM!

@gottesmm
Copy link
Contributor Author

Explanation: This commit ensures that when we canonicalize aggregate ARC operations on large structs, we do so consistently no matter the ARC operation that is used.
Scope: This is an important change since the inconsistent canonicalization can result in the ARC optimizer miscompiling. Additionally, this most likely caused us to lose code-size.
Radar (and possibly SR Issue): rdar://36509461
Risk: There is low risk to this change since we are just returning to our original consistency and the actual change in codegen is small. The risk to not taking this commit is high due to the possibility of ARC miscompiles.
Testing: I wrote compiler tests that validate that we are consistently expanded (or not) aggregate ARC operations.

@gottesmm
Copy link
Contributor Author

@shajrawi, @eeckstein asked me to make this as small as possible. I would rather just leave it in.

@gottesmm
Copy link
Contributor Author

Actually, I am going to come up with a test for the actual ARC failure as well for this PR. So I guess I can go through another test cycle.

… off the code-size hueristic.

We were expanding retain_value, release_value properly, but not
copy_addr/destroy_addr. This caused ARC invariants to break resulting in
miscompiles.

rdar://36509461
@gottesmm gottesmm force-pushed the swift-4.1-branch_rdar36509461 branch from 6ca0f7a to c52011a Compare January 25, 2018 21:56
@gottesmm
Copy link
Contributor Author

@swift-ci test

4 similar comments
@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm
Copy link
Contributor Author

@shahmishal Is something wrong here? Or am I being impatient?

@gottesmm
Copy link
Contributor Author

nm. The bots are being upgraded.

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 6ca0f7ac821ca2ac446bdfebdd509ad5a82d0741

@gottesmm gottesmm changed the title [sil] When expanding aggregate instructions, do so consistently based… [4.1][sil] When expanding aggregate instructions, do so consistently based… Jan 26, 2018
@gottesmm
Copy link
Contributor Author

@swift-ci test

4 similar comments
@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm
Copy link
Contributor Author

@swift-ci test

@shahmishal
Copy link
Member

Please wait for CI to catch up.

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 6ca0f7ac821ca2ac446bdfebdd509ad5a82d0741

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 6ca0f7ac821ca2ac446bdfebdd509ad5a82d0741

@gottesmm
Copy link
Contributor Author

Sorry for being so impatient Mishal!

@gottesmm gottesmm merged commit 5065593 into swiftlang:swift-4.1-branch Jan 26, 2018
@gottesmm gottesmm deleted the swift-4.1-branch_rdar36509461 branch January 26, 2018 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants