[SILOptimizer] Keep lexical lifetime markers. #39883
Merged
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.
Previously, TempRValueElimination would peephole simple alloc_stacks, even when they were lexical; here, they are left for Mem2Reg to properly handle.
Previously, SemanticARCOpts would eliminate lexical begin_borrows, incorrectly allowing the lifetime of the value borrowed by them to be observably shortened. Here, those borrow scopes are not eliminated if they are lexical.
Added an executable test that verifies that a local variable strongly referencing a delegate object keeps that delegate alive through the call to an object that weakly references the delegate and calls out to it.