6.0: [PrunedLiveness] Branch summary merges to ending. #74836
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.
Explanation: Fix underlying utility and reinstate lifetime completion during move checking.
To address a compiler crash, move-checking's lifetime completion was partially disabled. Here, it is reenabled now that the compiler crash will no longer occur.
The move-only address checker depends on complete lifetimes; without them, it miscompiles code. So, if the checker determines that it will have to transform the function, it completes all (non-reborrow) lifetimes before transforming. That completion was temporarily partially disabled because it was producing invalid SIL. Here, the underlying issue which caused completion to produce invalid SIL is fixed and lifetime completion is reinstated to run as before.
The underlying issue was an incorrect summary calculation done by the
PrunedLiveness
utility. Specifically, it determined that branch instructions (e.g.br bbN(%x, %y)
) were not lifetime-ending if they had both an owned value and a guaranteed value derived from that owned value as their operands†
. The result was ending lifetimes of the value actually consumed by the branch in the block that it branched to. This was invalid in a couple of ways: the value was overconsumed, the destroy might not dominate the def. In noasserts builds, this resulted in a compiler crash during LLVM.Now that the underlying issue is fixed, lifetime completion doesn't produce invalid SIL, and the compiler doesn't crash during LLVM.
†
In OSSA, in the target block, the guaranteed block argument is understood to be derived from the owned block argument.Scope: Affects noncopyable code.
Issue: rdar://130427564
Original PR: #74815 , #74835
Risk: Low.
Testing: Added and updated tests. Rebuilt project exhibiting compiler crash without fix.
Reviewer: Andrew Trick ( @atrick ), Meghana Gupta ( @meg-gupta )