diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-16 04:33:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-16 04:33:38 +0000 |
commit | 321e6a6e82e5908a3703777ddf9567b066c8e72a (patch) | |
tree | 954c098e3b5d65f8a296c6a969f2f6ed7f39e0bd /lib/Transforms | |
parent | 67abc10616618b7b7f3ebd873d4903893bf90544 (diff) | |
download | external_llvm-321e6a6e82e5908a3703777ddf9567b066c8e72a.zip external_llvm-321e6a6e82e5908a3703777ddf9567b066c8e72a.tar.gz external_llvm-321e6a6e82e5908a3703777ddf9567b066c8e72a.tar.bz2 |
Use new m_SelectCst template to eliminate macros.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59392 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 7e73727..f296543 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -4212,23 +4212,19 @@ static Instruction *MatchSelectFromAndOr(Value *A, Value *B, Value *C, Value *D) { // If A is not a select of -1/0, this cannot match. Value *Cond = 0, *Cond2 = 0; - if (!match(A, m_Select(m_Value(Cond), m_ConstantInt(-1), m_ConstantInt(0)))) + if (!match(A, m_SelectCst(m_Value(Cond), -1, 0))) return 0; -#define SELECT_MATCH(Val, I1, I2) \ - m_Select(m_Value(Val), m_ConstantInt(I1), m_ConstantInt(I2)) - // ((cond?-1:0)&C) | (B&(cond?0:-1)) -> cond ? C : B. - if (match(D, SELECT_MATCH(Cond2, 0, -1)) && Cond2 == Cond) + if (match(D, m_SelectCst(m_Value(Cond2), 0, -1)) && Cond2 == Cond) return SelectInst::Create(Cond, C, B); - if (match(D, m_Not(SELECT_MATCH(Cond2, -1, 0))) && Cond2 == Cond) + if (match(D, m_Not(m_SelectCst(m_Value(Cond2), -1, 0))) && Cond2 == Cond) return SelectInst::Create(Cond, C, B); // ((cond?-1:0)&C) | ((cond?0:-1)&D) -> cond ? C : D. - if (match(B, SELECT_MATCH(Cond2, 0, -1)) && Cond2 == Cond) + if (match(B, m_SelectCst(m_Value(Cond2), 0, -1)) && Cond2 == Cond) return SelectInst::Create(Cond, C, D); - if (match(B, m_Not(SELECT_MATCH(Cond2, -1, 0))) && Cond2 == Cond) + if (match(B, m_Not(m_SelectCst(m_Value(Cond2), -1, 0))) && Cond2 == Cond) return SelectInst::Create(Cond, C, D); -#undef SELECT_MATCH return 0; } |