Skip to content

Commit 4d4df6f

Browse files
committed
[InstCombine] remove redundant fold for insertelement; NFC
The out-of-bounds index pattern is handled by InstSimplify. llvm-svn: 361569
1 parent 3e4acaa commit 4d4df6f

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -884,14 +884,10 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) {
884884
if (match(IdxOp, m_ConstantInt(InsertedIdx)) &&
885885
match(ScalarOp, m_ExtractElement(m_Value(ExtVecOp),
886886
m_ConstantInt(ExtractedIdx)))) {
887-
unsigned NumInsertVectorElts = IE.getType()->getNumElements();
888887
unsigned NumExtractVectorElts = ExtVecOp->getType()->getVectorNumElements();
889888
if (ExtractedIdx >= NumExtractVectorElts) // Out of range extract.
890889
return replaceInstUsesWith(IE, VecOp);
891890

892-
if (InsertedIdx >= NumInsertVectorElts) // Out of range insert.
893-
return replaceInstUsesWith(IE, UndefValue::get(IE.getType()));
894-
895891
// If we are extracting a value from a vector, then inserting it right
896892
// back into the same place, just use the input vector.
897893
if (ExtVecOp == VecOp && ExtractedIdx == InsertedIdx)

0 commit comments

Comments
 (0)