[llvm] r361569 - [InstCombine] remove redundant fold for insertelement; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu May 23 16:33:35 PDT 2019
Author: spatel
Date: Thu May 23 16:33:34 2019
New Revision: 361569
URL: http://llvm.org/viewvc/llvm-project?rev=361569&view=rev
Log:
[InstCombine] remove redundant fold for insertelement; NFC
The out-of-bounds index pattern is handled by InstSimplify.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp?rev=361569&r1=361568&r2=361569&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp Thu May 23 16:33:34 2019
@@ -884,14 +884,10 @@ Instruction *InstCombiner::visitInsertEl
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)
More information about the llvm-commits
mailing list