summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-16 04:33:38 +0000
committerChris Lattner <sabre@nondot.org>2008-11-16 04:33:38 +0000
commitfae5e331115b5a1e674ede64880e835825b4f1c6 (patch)
treef925695ef35d2e653433be9a28e3bab67ec97bcf /llvm/lib/Transforms/Scalar/InstructionCombining.cpp
parent2e692e2a31a0155e272ec26e86010d52567db483 (diff)
downloadbcm5719-llvm-fae5e331115b5a1e674ede64880e835825b4f1c6.tar.gz
bcm5719-llvm-fae5e331115b5a1e674ede64880e835825b4f1c6.zip
Use new m_SelectCst template to eliminate macros.
llvm-svn: 59392
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 7e737277942..f296543814b 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud