[InstCombine] remove redundant fold for insertelement; NFC

The out-of-bounds index pattern is handled by InstSimplify.

llvm-svn: 361569
This commit is contained in:
Sanjay Patel 2019-05-23 23:33:34 +00:00
parent 3e4acaabb9
commit 4d4df6f144
1 changed files with 0 additions and 4 deletions

View File

@ -884,14 +884,10 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) {
if (match(IdxOp, m_ConstantInt(InsertedIdx)) &&
match(ScalarOp, m_ExtractElement(m_Value(ExtVecOp),
m_ConstantInt(ExtractedIdx)))) {
unsigned NumInsertVectorElts = IE.getType()->getNumElements();
unsigned NumExtractVectorElts = ExtVecOp->getType()->getVectorNumElements();
if (ExtractedIdx >= NumExtractVectorElts) // Out of range extract.
return replaceInstUsesWith(IE, VecOp);
if (InsertedIdx >= NumInsertVectorElts) // Out of range insert.
return replaceInstUsesWith(IE, UndefValue::get(IE.getType()));
// If we are extracting a value from a vector, then inserting it right
// back into the same place, just use the input vector.
if (ExtVecOp == VecOp && ExtractedIdx == InsertedIdx)