From: Chris Lattner Date: Sat, 15 Jan 2011 05:52:27 +0000 (+0000) Subject: Fix m_Not and m_Neg to not match random ConstantInt's. Before X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=4de2c7654289bb655edfad70c18a4a1352827bd0;p=oota-llvm.git 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123518 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h index 8b5812141df..322ed436c9f 100644 --- a/include/llvm/Support/PatternMatch.h +++ b/include/llvm/Support/PatternMatch.h @@ -521,8 +521,6 @@ struct not_match { if (ConstantExpr *CE = dyn_cast(V)) if (CE->getOpcode() == Instruction::Xor) return matchIfNot(CE->getOperand(0), CE->getOperand(1)); - if (ConstantInt *CI = dyn_cast(V)) - return L.match(ConstantExpr::getNot(CI)); return false; } private: @@ -557,8 +555,6 @@ struct neg_match { if (ConstantExpr *CE = dyn_cast(V)) if (CE->getOpcode() == Instruction::Sub) return matchIfNeg(CE->getOperand(0), CE->getOperand(1)); - if (ConstantInt *CI = dyn_cast(V)) - return L.match(ConstantExpr::getNeg(CI)); return false; } private: