[InstCombine] Erase old instruction when replacing extractelements

As we are not returning the result of replaceInstUsesWith(),
so we need to clean up ourselves.

NFC apart from worklist order.
This commit is contained in:
Nikita Popov 2020-03-30 22:05:34 +02:00
parent 4b35c816ef
commit d40368fdb5
1 changed files with 1 additions and 0 deletions

View File

@ -597,6 +597,7 @@ static void replaceExtractElements(InsertElementInst *InsElt,
auto *NewExt = ExtractElementInst::Create(WideVec, OldExt->getOperand(1));
NewExt->insertAfter(OldExt);
IC.replaceInstUsesWith(*OldExt, NewExt);
IC.eraseInstFromFunction(*OldExt);
}
}