diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp index d3ccdcd5ffd..034591a00fe 100644 --- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -791,6 +791,10 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op, // TODO: Should we check for other forms of sign-bit comparisons? // Examples: X <= -1, X >= 0 } + if (getBooleanContents(Op0.getValueType()) == + TargetLowering::ZeroOrOneBooleanContent && + BitWidth > 1) + KnownZero.setBitsFrom(1); break; } case ISD::SHL: @@ -1233,7 +1237,7 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op, return true; assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); - KnownZero |= ~InMask & NewMask; + KnownZero |= ~InMask; break; } case ISD::BITCAST: