Skip to content

Commit f99eb1d

Browse files
committed
Fix possible iterator invalidation in SILMem2Reg
1 parent 344ef14 commit f99eb1d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/SILOptimizer/Transforms/SILMem2Reg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ replaceLoad(SILInstruction *inst, SILValue newValue, AllocStackInst *asi,
291291
endBorrows.push_back(ebi);
292292
}
293293
for (auto *ebi : endBorrows) {
294-
ebi->eraseFromParent();
294+
prepareForDeletion(ebi, instructionsToDelete);
295295
}
296296
lbi->replaceAllUsesWith(newValue);
297297
}

0 commit comments

Comments
 (0)