diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-01-05 23:53:12 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-01-05 23:53:12 +0000 |
| commit | 2fdcc59bb6bba29defb314199550516cfdc950e3 (patch) | |
| tree | e3fbc734c33d6f4a0e992c6f7c0d243c46e626e7 /llvm/lib/Transforms | |
| parent | 4e735eb15717401d5bbe2f48bf729fc43e26ff69 (diff) | |
| download | bcm5719-llvm-2fdcc59bb6bba29defb314199550516cfdc950e3.tar.gz bcm5719-llvm-2fdcc59bb6bba29defb314199550516cfdc950e3.zip | |
Change m_ConstantInt and m_SelectCst to take their constant integers
as template arguments instead of as instance variables, exposing more
optimization opportunities to the compiler earlier.
llvm-svn: 61776
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index b1474cca843..83158276e2c 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -4276,18 +4276,18 @@ 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; - if (!match(A, m_SelectCst(m_Value(Cond), -1, 0))) + if (!match(A, m_SelectCst<-1, 0>(m_Value(Cond)))) return 0; // ((cond?-1:0)&C) | (B&(cond?0:-1)) -> cond ? C : B. - if (match(D, m_SelectCst(m_Specific(Cond), 0, -1))) + if (match(D, m_SelectCst<0, -1>(m_Specific(Cond)))) return SelectInst::Create(Cond, C, B); - if (match(D, m_Not(m_SelectCst(m_Specific(Cond), -1, 0)))) + if (match(D, m_Not(m_SelectCst<-1, 0>(m_Specific(Cond))))) return SelectInst::Create(Cond, C, B); // ((cond?-1:0)&C) | ((cond?0:-1)&D) -> cond ? C : D. - if (match(B, m_SelectCst(m_Specific(Cond), 0, -1))) + if (match(B, m_SelectCst<0, -1>(m_Specific(Cond)))) return SelectInst::Create(Cond, C, D); - if (match(B, m_Not(m_SelectCst(m_Specific(Cond), -1, 0)))) + if (match(B, m_Not(m_SelectCst<-1, 0>(m_Specific(Cond))))) return SelectInst::Create(Cond, C, D); return 0; } @@ -8713,11 +8713,11 @@ Instruction *InstCombiner::visitSelectInstWithICmp(SelectInst &SI, // (x <s 0) ? -1 : 0 -> ashr x, 31 -> all ones if signed // (x >s -1) ? -1 : 0 -> ashr x, 31 -> all ones if not signed CmpInst::Predicate Pred = CmpInst::BAD_ICMP_PREDICATE; - if (match(TrueVal, m_ConstantInt(-1)) && - match(FalseVal, m_ConstantInt(0))) + if (match(TrueVal, m_ConstantInt<-1>()) && + match(FalseVal, m_ConstantInt<0>())) Pred = ICI->getPredicate(); - else if (match(TrueVal, m_ConstantInt(0)) && - match(FalseVal, m_ConstantInt(-1))) + else if (match(TrueVal, m_ConstantInt<0>()) && + match(FalseVal, m_ConstantInt<-1>())) Pred = CmpInst::getInversePredicate(ICI->getPredicate()); if (Pred != CmpInst::BAD_ICMP_PREDICATE) { |

