mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Check lexicality at reborrow instead of borrow while disabling DCE
This commit is contained in:
@@ -283,8 +283,8 @@ void DCE::markLive() {
|
||||
}
|
||||
case SILInstructionKind::EndBorrowInst: {
|
||||
auto phi = PhiValue(I.getOperand(0));
|
||||
// If there is a pointer escape, disable DCE.
|
||||
if (phi && hasPointerEscape(phi)) {
|
||||
// If there is a pointer escape or phi is lexical, disable DCE.
|
||||
if (phi && (hasPointerEscape(phi) || phi->isLexical())) {
|
||||
markInstructionLive(&I);
|
||||
}
|
||||
// The instruction is live only if it's operand value is also live
|
||||
@@ -320,10 +320,6 @@ void DCE::markLive() {
|
||||
disableBorrowDCE(root);
|
||||
}
|
||||
}
|
||||
// If we have a lexical borrow scope, disable DCE.
|
||||
if (borrowInst->isLexical()) {
|
||||
disableBorrowDCE(borrowInst);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SILInstructionKind::LoadBorrowInst: {
|
||||
|
||||
Reference in New Issue
Block a user