Index: lib/Analysis/InstructionSimplify.cpp =================================================================== --- lib/Analysis/InstructionSimplify.cpp +++ lib/Analysis/InstructionSimplify.cpp @@ -565,10 +565,10 @@ // 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)))) + const APInt *C0, *C1; + if ((isNSW || isNUW) && match(Op1, m_APInt(C0)) && + match(Op0, m_Xor(m_Value(Y), m_APInt(C1))) && + C0->isSignBit() && C1->isSignBit()) return Y; /// i1 add -> xor.