-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[move-only] Fix SIL representation and SILOptimizer to preserve value deinits #66314
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
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6b53365
[move-only] Comment emitMoveOnlyMemberDestruction drop_deinit
atrick 2f200a6
[move-only] Fix drop_deinit OSSA lowering
atrick 521f0ff
[move-only] Verify drop_deinit
atrick 0bbd92a
[move-only] Rename MoveOnlyDeinitInsertion
atrick 62b0899
[move-only] Disable move-only devirtualization.
atrick f7d30d4
[move-only] Fix SILOptimizer expansion to preserve deinits.
atrick 85317c6
[move-only] Fix dead code elimination to preserve value deinits.
atrick 280761f
[move-only] Fix SILOptimizer code motion to preserve value deinits
atrick 9345ba4
[move-only] Fix SILCombine to preserve value deinit
atrick ef6de50
[move-only] Fix TypeLowering to preserve value deinits
atrick e3fa77e
[move-only] Update tests for drop_deinit lowering.
atrick d55ca8a
Disable SILGen/discard.swift on Windows.
atrick af1d0d4
cleanup whitespace in sil_combine_moveonly.sil
atrick 46dbf8e
Cleanup SILCombine hasValueDeinit checks
atrick File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Question. Shouldn't we perhaps do the same thing here for destroy_addr like we do for objects. Then we would be really consistent across the code base.
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.
drop_deinit
on an address doesn't have the same OSSA semantics as it does on a value. The address and value forms definitely should be separate opcodes to avoid this confusion (in some later PR).It is analogous to destroy_addr vs. destroy_value. destroy_addr has nothing to do with OSSA, and drop_deinit on an address does not change the meaning of any subsequent destroy_addr. drop_deinit on an address does not actually do anything except block optimization on the address, preventing us from promoting it to OSSA!
So drop_deinit on an address doesn't have any SIL requirements and has no structural verification. As such, SILGen cannot emit a destroy_addr for a discarded value. That would be outright wrong. And OSSA lowering is not affected at all by a drop_deinit on an address.