[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.

llvm-svn: 361570
This commit is contained in:
Sanjay Patel 2019-05-23 23:33:38 +00:00
parent 4d4df6f144
commit 093c922205
1 changed files with 0 additions and 4 deletions
llvm/lib/Transforms/InstCombine

View File

@ -884,10 +884,6 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) {
if (match(IdxOp, m_ConstantInt(InsertedIdx)) && if (match(IdxOp, m_ConstantInt(InsertedIdx)) &&
match(ScalarOp, m_ExtractElement(m_Value(ExtVecOp), match(ScalarOp, m_ExtractElement(m_Value(ExtVecOp),
m_ConstantInt(ExtractedIdx)))) { 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 // If we are extracting a value from a vector, then inserting it right
// back into the same place, just use the input vector. // back into the same place, just use the input vector.
if (ExtVecOp == VecOp && ExtractedIdx == InsertedIdx) if (ExtVecOp == VecOp && ExtractedIdx == InsertedIdx)