diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index 97a001b2ed320..9f1de3c5dec65 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -3896,8 +3896,8 @@ Instruction *InstCombinerImpl::foldNot(BinaryOperator &I) { if (match(NotVal, m_AShr(m_Not(m_Value(X)), m_Value(Y)))) return BinaryOperator::CreateAShr(X, Y); - // Bit-hack form of a signbit test: - // iN ~X >>s (N-1) --> sext i1 (X > -1) to iN + // Bit-hack form of a signbit test for iN type: + // ~(X >>s (N - 1)) --> sext i1 (X > -1) to iN unsigned FullShift = Ty->getScalarSizeInBits() - 1; if (match(NotVal, m_OneUse(m_AShr(m_Value(X), m_SpecificInt(FullShift))))) { Value *IsNotNeg = Builder.CreateIsNotNeg(X, "isnotneg");