[llvm] r299121 - [InstSimplify] Use m_SignBit instead of calling getSignBit and using m_Specific. NFCI

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 15:21:17 PDT 2017


Author: ctopper
Date: Thu Mar 30 17:21:16 2017
New Revision: 299121

URL: http://llvm.org/viewvc/llvm-project?rev=299121&view=rev
Log:
[InstSimplify] Use m_SignBit instead of calling getSignBit and using m_Specific. NFCI

Modified:
    llvm/trunk/lib/Analysis/InstructionSimplify.cpp

Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=299121&r1=299120&r2=299121&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original)
+++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Thu Mar 30 17:21:16 2017
@@ -565,10 +565,8 @@ static Value *SimplifyAddInst(Value *Op0
   // add nsw/nuw (xor Y, signbit), signbit --> Y
   // The no-wrapping add guarantees that the top bit will be set by the add.
   // Therefore, the xor must be clearing the already set sign bit of Y.
-  Constant *SignBit =
-      ConstantInt::get(Ty, APInt::getSignBit(Ty->getScalarSizeInBits()));
-  if ((isNSW || isNUW) && match(Op1, m_Specific(SignBit)) &&
-      match(Op0, m_Xor(m_Value(Y), m_Specific(SignBit))))
+  if ((isNSW || isNUW) && match(Op1, m_SignBit()) &&
+      match(Op0, m_Xor(m_Value(Y), m_SignBit())))
     return Y;
 
   /// i1 add -> xor.




More information about the llvm-commits mailing list