mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
DeadCodeElimination: don't remove end_lifetime instructions with address operands
DCE cannot reason about values in memory. Fixes a memory lifetime verification error rdar://139779406
This commit is contained in:
@@ -317,6 +317,11 @@ void DCE::markLive() {
|
||||
break;
|
||||
}
|
||||
case SILInstructionKind::EndLifetimeInst: {
|
||||
if (I.getOperand(0)->getType().isAddress()) {
|
||||
// DCE cannot reason about values in memory.
|
||||
markInstructionLive(&I);
|
||||
break;
|
||||
}
|
||||
// The instruction is live only if it's operand value is also live
|
||||
addReverseDependency(I.getOperand(0), &I);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user