Skip to content

Conversation

nate-chandler
Copy link
Contributor

Owned lifetime canonicalization bails on move-only values.

Previously, though, every value that was fed to canonicalization was then attempted to be deleted. For dead move-only values, the result could be to shorten move-only lifetimes, which is illegal per language rules.

Here, this is fixed by not attempting to delete owned values for which canonicalization bailed.

rdar://114323803

@nate-chandler
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@meg-gupta meg-gupta left a comment

Choose a reason for hiding this comment

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

LGTM!

@nate-chandler
Copy link
Contributor Author

@swift-ci please test linux platform

@atrick
Copy link
Contributor

atrick commented Aug 23, 2023

Trivial types can be dead code eliminated. Whether they are Copyable is irrelevant.

This should already be handled correctly by canTriviallyDeleteOSSAEndScopeInst

If you add a struct-deinit to your type, are we still shortening the lifetime? That would be wrong. Similar problem if the type has a member which has a struct-deinit

Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

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

the patch seems good, but i don't think the test case is correct without adding some deinit or nontrivial member to MOS

Owned lifetime canonicalization bails on move-only values.

Previously, though, every value that was fed to canonicalization was
then attempted to be deleted.  For dead move-only values, the result
could be to shorten move-only lifetimes, which is illegal per language
rules.

Here, this is fixed by not attempting to delete owned values for which
canonicalization bailed.

rdar://114323803
@nate-chandler
Copy link
Contributor Author

@atrick Fixed.

@nate-chandler
Copy link
Contributor Author

@swift-ci please test and merge

@nate-chandler
Copy link
Contributor Author

@swift-ci please test linux platform

@nate-chandler nate-chandler merged commit 3687ddf into swiftlang:main Aug 24, 2023
@nate-chandler nate-chandler deleted the rdar114323803 branch August 24, 2023 14:03
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.

3 participants