Skip to content

Conversation

meg-gupta
Copy link
Contributor

@meg-gupta meg-gupta commented Apr 21, 2025

Cherry-pick from #80733. This change is needed for analyzing performance annotations due to the changes to the stdlib in #80956.

In CopyToBorrowOptimization, a copy_value with a guaranteed operand can be optimized away if all uses of copy_value can be replaced by the guaranteed operand and if the guaranteed operand's scope outlives the copy_value liveness.

For this, it uses lookThroughForwardingInstructions. Until now, for borrowed from instructions this utility returned its singleForwardedOperand which is a phi and not handled in isFullyContainedIn.

If the borrowed from instruction has a single enclosing value, we can return this instead enabling more optimizations if it turns out to be handled by isFullyContainedIn .

@meg-gupta meg-gupta requested a review from a team as a code owner April 21, 2025 22:27
@meg-gupta meg-gupta requested a review from tbkka April 21, 2025 22:27
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta meg-gupta mentioned this pull request Apr 21, 2025
@meg-gupta meg-gupta enabled auto-merge April 21, 2025 23:29
@meg-gupta meg-gupta merged commit 9e7257c into swiftlang:release/6.2 Apr 22, 2025
5 checks passed
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.

2 participants