Skip to content

Commit 78a2eeb

Browse files
committed
[ShrinkBorrowScope] Hoist over copies of borrow.
1 parent 0fd48fc commit 78a2eeb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/SILOptimizer/Utils/ShrinkBorrowScope.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ class ShrinkBorrowScope {
168168
bbi->setOperand(borrowee);
169169
return true;
170170
}
171+
} else if (auto *cvi = dyn_cast<CopyValueInst>(instruction)) {
172+
if (canReplaceValueWithBorrowedValue(cvi->getOperand())) {
173+
auto borrowee = introducer->getOperand();
174+
cvi->setOperand(borrowee);
175+
return true;
176+
}
171177
}
172178
return false;
173179
}

0 commit comments

Comments
 (0)