Skip to content

[CopyPropagation] Eliminate redundant moves. #64339

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

Conversation

nate-chandler
Copy link
Contributor

@nate-chandler nate-chandler commented Mar 14, 2023

SemanticARCOpts already eliminates move_values that are redundant that block its optimizations. But it's always run after CopyPropagation.

Because move_values divide copy-extended lifetimes, move_values obstruct lifetime canonicalization. If a move_value isn't separating lifetimes with different characteristics (specifically: lexicallity, escaping), then it is only obstructing lifetime canonicalization. Remove it before canonicalizing the lifetime of the moved-from value.

rdar://106834481

Extracted the predicate from inline in RedundantMoveValueElimination
into the new function which can now be called from elsewhere
(CopyPropagation).
No need for a worklist of any sort, a simple list suffices.
SemanticARCOpts already eliminates move values that are redundant that
block its optimizations.  But it's always run after CopyPropagation.

Because move_values divide copy-extended lifetimes, move_values obstruct
lifetime canonicalization.  If a move_value isn't separating lifetimes
with different characteristics (specifically: lexicallity, escaping),
then it is only obstructing lifetime canonicalization.  Remove it
before canonicalizing the lifetime of the moved-from value.
@nate-chandler nate-chandler force-pushed the copy-propagation/redundant-move-elim branch from 45f1881 to 1621692 Compare March 15, 2023 18:57
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler
Copy link
Contributor Author

@swift-ci please test windows platform

@nate-chandler nate-chandler merged commit 1f3623d into swiftlang:main Mar 17, 2023
@nate-chandler nate-chandler deleted the copy-propagation/redundant-move-elim branch March 17, 2023 00:02
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.

1 participant