Skip to content

Commit 21a0218

Browse files
authored
Merge pull request #8684 from atrick/fix
2 parents b5b2565 + 9cb7b4f commit 21a0218

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/SIL/SILBasicBlock.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,16 @@ void SILBasicBlock::remove(SILInstruction *I) {
9090
InstList.remove(I);
9191
}
9292

93+
/// Returns the iterator following the erased instruction, STL-style.
9394
SILBasicBlock::iterator SILBasicBlock::erase(SILInstruction *I) {
9495
// Notify the delete handlers that this instruction is going away.
9596
getModule().notifyDeleteHandlers(&*I);
9697
auto *F = getParent();
97-
auto II = InstList.erase(I);
98+
// LLVM does not currently implement ilist::erase correctly. Compensate.
99+
iterator next = std::next(SILBasicBlock::iterator(I));
100+
InstList.erase(I);
98101
F->getModule().deallocateInst(I);
99-
return II;
102+
return next;
100103
}
101104

102105
/// This method unlinks 'self' from the containing SILFunction and deletes it.

0 commit comments

Comments
 (0)