mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Correctly implement SILBasicBlock::erase().
LLVM ilist::erase does not return the following iterator the way an STL list would. Compensate by computing the next iterator and ignoring LLVM's result. I expect this to fix the ASAN bots: <rdar://problem/31550303> OSS Swift CI ASAN bot fails on AccessMarker tests.
This commit is contained in:
@@ -90,13 +90,16 @@ void SILBasicBlock::remove(SILInstruction *I) {
|
||||
InstList.remove(I);
|
||||
}
|
||||
|
||||
/// Returns the iterator following the erased instruction, STL-style.
|
||||
SILBasicBlock::iterator SILBasicBlock::erase(SILInstruction *I) {
|
||||
// Notify the delete handlers that this instruction is going away.
|
||||
getModule().notifyDeleteHandlers(&*I);
|
||||
auto *F = getParent();
|
||||
auto II = InstList.erase(I);
|
||||
// LLVM does not currently implement ilist::erase correctly. Compensate.
|
||||
iterator next = std::next(SILBasicBlock::iterator(I));
|
||||
InstList.erase(I);
|
||||
F->getModule().deallocateInst(I);
|
||||
return II;
|
||||
return next;
|
||||
}
|
||||
|
||||
/// This method unlinks 'self' from the containing SILFunction and deletes it.
|
||||
|
||||
Reference in New Issue
Block a user