summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-05-26 05:16:20 +0000
committerCraig Topper <craig.topper@gmail.com>2017-05-26 05:16:20 +0000
commit50500d505456a61672c10e4101dd35d8eee9f164 (patch)
treeac428b6ee435be44b6280022ad70d6bb1ad95b25 /llvm/lib/Analysis
parent298dbf9e89ec56f568d89203ef1182f527709b95 (diff)
downloadbcm5719-llvm-50500d505456a61672c10e4101dd35d8eee9f164.tar.gz
bcm5719-llvm-50500d505456a61672c10e4101dd35d8eee9f164.zip
[InstSimplify] Use m_ConstantInt matchers to short some code. NFC
llvm-svn: 303967
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index f10e2378fdb..34ca389ad21 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -1921,13 +1921,11 @@ static Value *SimplifyOrInst(Value *Op0, Value *Op1, const SimplifyQuery &Q,
MaxRecurse))
return V;
- // (A & C)|(B & D)
- Value *C = nullptr, *D = nullptr;
- if (match(Op0, m_And(m_Value(A), m_Value(C))) &&
- match(Op1, m_And(m_Value(B), m_Value(D)))) {
- ConstantInt *C1 = dyn_cast<ConstantInt>(C);
- ConstantInt *C2 = dyn_cast<ConstantInt>(D);
- if (C1 && C2 && (C1->getValue() == ~C2->getValue())) {
+ // (A & C1)|(B & C2)
+ ConstantInt *C1, *C2;
+ if (match(Op0, m_And(m_Value(A), m_ConstantInt(C1))) &&
+ match(Op1, m_And(m_Value(B), m_ConstantInt(C2)))) {
+ if (C1->getValue() == ~C2->getValue()) {
// (A & C1)|(B & C2)
// If we have: ((V + N) & C1) | (V & C2)
// .. and C2 = ~C1 and C2 is 0+1+ and (N & C2) == 0
OpenPOWER on IntegriCloud