[llvm] r303967 - [InstSimplify] Use m_ConstantInt matchers to short some code. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu May 25 22:16:21 PDT 2017
Author: ctopper
Date: Fri May 26 00:16:20 2017
New Revision: 303967
URL: http://llvm.org/viewvc/llvm-project?rev=303967&view=rev
Log:
[InstSimplify] Use m_ConstantInt matchers to short some code. NFC
Modified:
llvm/trunk/lib/Analysis/InstructionSimplify.cpp
Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=303967&r1=303966&r2=303967&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original)
+++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Fri May 26 00:16:20 2017
@@ -1921,13 +1921,11 @@ static Value *SimplifyOrInst(Value *Op0,
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
More information about the llvm-commits
mailing list