summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-07-08 17:26:47 +0000
committerSanjay Patel <spatel@rotateright.com>2016-07-08 17:26:47 +0000
commit1b6b82454883419852fc3aafc94e30dcfe5e4671 (patch)
treea1ca9104bd54e6b30670464f8d1cc78c1938ba4b /llvm/lib
parent068a8054aed30c587619bec7e4d25fb11d9a9834 (diff)
downloadbcm5719-llvm-1b6b82454883419852fc3aafc94e30dcfe5e4671.tar.gz
bcm5719-llvm-1b6b82454883419852fc3aafc94e30dcfe5e4671.zip
[InstCombine] check for one-use before turning simple logic op into a select
llvm-svn: 274891
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index f6ec03b9721..eadf0bf67a4 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -2394,10 +2394,10 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
return CastedOr;
// or(sext(A), B) / or(B, sext(A)) --> A ? -1 : B, where A is i1 or <N x i1>.
- if (match(Op0, m_SExt(m_Value(A))) &&
+ if (match(Op0, m_OneUse(m_SExt(m_Value(A)))) &&
A->getType()->getScalarType()->isIntegerTy(1))
return SelectInst::Create(A, ConstantInt::getSigned(I.getType(), -1), Op1);
- if (match(Op1, m_SExt(m_Value(A))) &&
+ if (match(Op1, m_OneUse(m_SExt(m_Value(A)))) &&
A->getType()->getScalarType()->isIntegerTy(1))
return SelectInst::Create(A, ConstantInt::getSigned(I.getType(), -1), Op0);
OpenPOWER on IntegriCloud