[llvm] d40368f - [InstCombine] Erase old instruction when replacing extractelements
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 1 10:56:14 PDT 2020
Author: Nikita Popov
Date: 2020-04-01T19:55:28+02:00
New Revision: d40368fdb5e1b90e68b1078f32c283aa800238be
URL: https://github.com/llvm/llvm-project/commit/d40368fdb5e1b90e68b1078f32c283aa800238be
DIFF: https://github.com/llvm/llvm-project/commit/d40368fdb5e1b90e68b1078f32c283aa800238be.diff
LOG: [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.
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index 2d72696ee531..1f7279fb9299 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -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);
}
}
More information about the llvm-commits
mailing list