[llvm-commits] [llvm] r123518 - /llvm/trunk/include/llvm/Support/PatternMatch.h

Chris Lattner sabre at nondot.org
Fri Jan 14 21:52:27 PST 2011


Author: lattner
Date: Fri Jan 14 23:52:27 2011
New Revision: 123518

URL: http://llvm.org/viewvc/llvm-project?rev=123518&view=rev
Log:
Fix m_Not and m_Neg to not match random ConstantInt's.  Before
these would try hard to match constants by inverting the bits
and recursively matching.  There are two problems with this:
1) some patterns would match when we didn't want them to (theoretical)
2) this is insanely expensive to do, and most often pointless.

This was apparently useful in just 2 instcombine cases, which I
added code to handle explicitly.  This change speeds up 'opt'
time on 176.gcc by 1% and produces bitwise identical code.


Modified:
    llvm/trunk/include/llvm/Support/PatternMatch.h

Modified: llvm/trunk/include/llvm/Support/PatternMatch.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PatternMatch.h?rev=123518&r1=123517&r2=123518&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/PatternMatch.h (original)
+++ llvm/trunk/include/llvm/Support/PatternMatch.h Fri Jan 14 23:52:27 2011
@@ -521,8 +521,6 @@
     if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
       if (CE->getOpcode() == Instruction::Xor)
         return matchIfNot(CE->getOperand(0), CE->getOperand(1));
-    if (ConstantInt *CI = dyn_cast<ConstantInt>(V))
-      return L.match(ConstantExpr::getNot(CI));
     return false;
   }
 private:
@@ -557,8 +555,6 @@
     if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V))
       if (CE->getOpcode() == Instruction::Sub)
         return matchIfNeg(CE->getOperand(0), CE->getOperand(1));
-    if (ConstantInt *CI = dyn_cast<ConstantInt>(V))
-      return L.match(ConstantExpr::getNeg(CI));
     return false;
   }
 private:





More information about the llvm-commits mailing list