From: Sanjay Patel Date: Thu, 23 May 2019 23:33:34 +0000 (+0000) Subject: [InstCombine] remove redundant fold for insertelement; NFC X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=71b5f9d74a33e59d7a50a2b3e36b41beead6224b;p=llvm [InstCombine] remove redundant fold for insertelement; NFC The out-of-bounds index pattern is handled by InstSimplify. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361569 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/lib/Transforms/InstCombine/InstCombineVectorOps.cpp index 44130d3246b..063175b45cb 100644 --- a/lib/Transforms/InstCombine/InstCombineVectorOps.cpp +++ b/lib/Transforms/InstCombine/InstCombineVectorOps.cpp @@ -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)