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

Friedman, Eli via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 15:44:19 PDT 2017


On 3/30/2017 3:21 PM, Craig Topper via llvm-commits wrote:
> 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;
>   

Are you certain there's no functional change here?  m_SignBit() also 
matches vectors.

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the llvm-commits mailing list