We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6c0c3dd commit a1bcf17Copy full SHA for a1bcf17
lib/SILOptimizer/Transforms/DeadCodeElimination.cpp
@@ -303,7 +303,10 @@ void DCE::markLive() {
303
}
304
// Populate reborrowDependencies for this borrow
305
findReborrowDependencies(borrowInst);
306
- if (hasPointerEscape(BorrowedValue(borrowInst))) {
+ // Don't optimize a borrow scope if it is lexical or has a pointer
307
+ // escape.
308
+ if (borrowInst->isLexical() ||
309
+ hasPointerEscape(BorrowedValue(borrowInst))) {
310
// Visit all end_borrows and mark them live
311
visitTransitiveEndBorrows(borrowInst, [&](EndBorrowInst *endBorrow) {
312
markInstructionLive(endBorrow);
0 commit comments