]> granicus.if.org Git - llvm/commitdiff
[Analysis][Transforms] Use commutable matchers instead of m_CombineOr in a few places...
authorCraig Topper <craig.topper@gmail.com>
Sat, 24 Jun 2017 06:24:01 +0000 (06:24 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sat, 24 Jun 2017 06:24:01 +0000 (06:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306204 cdac9f57-aa62-4fd3-8940-286f4534e8a0

lib/Analysis/InstructionSimplify.cpp
lib/Transforms/InstCombine/InstCombineCompares.cpp
lib/Transforms/Utils/LoopUtils.cpp

index a975be79619b7b04c0c2b6fca4471a771ae1b8ee..d9e32a3c417e070e8be7279c601e6a8e1ecf2fd6 100644 (file)
@@ -2688,16 +2688,14 @@ static Value *simplifyICmpWithBinOp(CmpInst::Predicate Pred, Value *LHS,
   }
 
   // icmp pred (and X, Y), X
-  if (LBO && match(LBO, m_CombineOr(m_And(m_Value(), m_Specific(RHS)),
-                                    m_And(m_Specific(RHS), m_Value())))) {
+  if (LBO && match(LBO, m_c_And(m_Value(), m_Specific(RHS)))) {
     if (Pred == ICmpInst::ICMP_UGT)
       return getFalse(ITy);
     if (Pred == ICmpInst::ICMP_ULE)
       return getTrue(ITy);
   }
   // icmp pred X, (and X, Y)
-  if (RBO && match(RBO, m_CombineOr(m_And(m_Value(), m_Specific(LHS)),
-                                    m_And(m_Specific(LHS), m_Value())))) {
+  if (RBO && match(RBO, m_c_And(m_Value(), m_Specific(LHS)))) {
     if (Pred == ICmpInst::ICMP_UGE)
       return getTrue(ITy);
     if (Pred == ICmpInst::ICMP_ULT)
index bc79e4534e65a6d940f13369c2a19cf4504edd01..6ad32490a3288aca9ab16e01b7312f55dab6c6b0 100644 (file)
@@ -3198,8 +3198,7 @@ Instruction *InstCombiner::foldICmpBinOp(ICmpInst &I) {
   if (BO0) {
     // Transform  A & (L - 1) `ult` L --> L != 0
     auto LSubOne = m_Add(m_Specific(Op1), m_AllOnes());
-    auto BitwiseAnd =
-        m_CombineOr(m_And(m_Value(), LSubOne), m_And(LSubOne, m_Value()));
+    auto BitwiseAnd = m_c_And(m_Value(), LSubOne);
 
     if (match(BO0, BitwiseAnd) && Pred == ICmpInst::ICMP_ULT) {
       auto *Zero = Constant::getNullValue(BO0->getType());
index be151a3e50805057fe228c5d84ca3ca28b2b64ea..88fa9812da40aa2335ceac187a5bc90f87c782c2 100644 (file)
@@ -88,8 +88,7 @@ RecurrenceDescriptor::lookThroughAnd(PHINode *Phi, Type *&RT,
 
   // Matches either I & 2^x-1 or 2^x-1 & I. If we find a match, we update RT
   // with a new integer type of the corresponding bit width.
-  if (match(J, m_CombineOr(m_And(m_Instruction(I), m_APInt(M)),
-                           m_And(m_APInt(M), m_Instruction(I))))) {
+  if (match(J, m_c_And(m_Instruction(I), m_APInt(M)))) {
     int32_t Bits = (*M + 1).exactLogBase2();
     if (Bits > 0) {
       RT = IntegerType::get(Phi->getContext(), Bits);