summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-10-19 17:54:53 +0000
committerSanjay Patel <spatel@rotateright.com>2018-10-19 17:54:53 +0000
commit70daf85bc2ca8e826b73c41f236e96c17ea87e28 (patch)
treeb04b6292120e7fafb6d4d22e969bd823d0538c38 /llvm/lib/Transforms
parent6bfc6577f283d4566035bb0dc97d42002b6f2516 (diff)
downloadbcm5719-llvm-70daf85bc2ca8e826b73c41f236e96c17ea87e28.tar.gz
bcm5719-llvm-70daf85bc2ca8e826b73c41f236e96c17ea87e28.zip
[InstCombine] use m_Neg() in dyn_castNegVal() to match vectors with undef elts
llvm-svn: 344793
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstructionCombining.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index ae7d08149c6..34a5e1955b6 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -747,8 +747,9 @@ Value *InstCombiner::SimplifySelectsFeedingBinaryOp(BinaryOperator &I,
/// Given a 'sub' instruction, return the RHS of the instruction if the LHS is a
/// constant zero (which is the 'negate' form).
Value *InstCombiner::dyn_castNegVal(Value *V) const {
- if (BinaryOperator::isNeg(V))
- return BinaryOperator::getNegArgument(V);
+ Value *NegV;
+ if (match(V, m_Neg(m_Value(NegV))))
+ return NegV;
// Constants can be considered to be negated values if they can be folded.
if (ConstantInt *C = dyn_cast<ConstantInt>(V))
OpenPOWER on IntegriCloud