mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix eraseFromParentWithdebugInsts to call a callback.
The recursivelyDeleteTriviallyDeadInstructions utility takes a callBack to be called for every deleted instruction. However, it wasn't passing this callBack to eraseFromParentWithdebugInsts. The callback was used to update an iterator in some cases, so not calling it resulted in iterator invalidation. Doing this also cleans up the both APIs: recursivelyDeleteTriviallyDeadInstructions and eraseFromParentWithdebugInsts.
This commit is contained in:
@@ -518,11 +518,13 @@ void SILInlineCloner::fixUp(SILFunction *calleeFunction) {
|
||||
assert(!Apply.getInstruction()->hasUsesOfAnyResult());
|
||||
|
||||
auto deleteCallback = [this](SILInstruction *deletedI) {
|
||||
if (NextIter == deletedI->getIterator())
|
||||
++NextIter;
|
||||
if (DeletionCallback)
|
||||
DeletionCallback(deletedI);
|
||||
};
|
||||
NextIter = recursivelyDeleteTriviallyDeadInstructions(Apply.getInstruction(),
|
||||
true, deleteCallback);
|
||||
recursivelyDeleteTriviallyDeadInstructions(Apply.getInstruction(), true,
|
||||
deleteCallback);
|
||||
}
|
||||
|
||||
SILValue SILInlineCloner::borrowFunctionArgument(SILValue callArg,
|
||||
|
||||
Reference in New Issue
Block a user