From: Sanjay Patel Date: Thu, 23 May 2019 23:33:38 +0000 (+0000) Subject: [InstCombine] remove redundant fold for extractelement; NFC X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3cce33d6aa1e3f65e403569923fafc629c15eb65;p=llvm [InstCombine] remove redundant fold for extractelement; NFC The out-of-bounds index pattern is handled by InstSimplify, so the extractelement should be eliminated next time it is visited. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361570 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/lib/Transforms/InstCombine/InstCombineVectorOps.cpp index 063175b45cb..c3fd612a9d0 100644 --- a/lib/Transforms/InstCombine/InstCombineVectorOps.cpp +++ b/lib/Transforms/InstCombine/InstCombineVectorOps.cpp @@ -884,10 +884,6 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) { if (match(IdxOp, m_ConstantInt(InsertedIdx)) && match(ScalarOp, m_ExtractElement(m_Value(ExtVecOp), m_ConstantInt(ExtractedIdx)))) { - unsigned NumExtractVectorElts = ExtVecOp->getType()->getVectorNumElements(); - if (ExtractedIdx >= NumExtractVectorElts) // Out of range extract. - return replaceInstUsesWith(IE, VecOp); - // 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)