mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 19:12:56 +02:00
[KnownBits] Use !hasConflict() in asserts in place of Zero & One == 0 or similar. NFC
llvm-svn: 303614
This commit is contained in:
parent
08b77c4665
commit
6e1fb25e6c
@ -603,11 +603,11 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
||||
|
||||
if (SimplifyDemandedBits(Op.getOperand(1), NewMask, Known, TLO, Depth+1))
|
||||
return true;
|
||||
assert((Known.Zero & Known.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
if (SimplifyDemandedBits(Op.getOperand(0), ~Known.Zero & NewMask,
|
||||
Known2, TLO, Depth+1))
|
||||
return true;
|
||||
assert((Known2.Zero & Known2.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert(!Known2.hasConflict() && "Bits known to be one AND zero?");
|
||||
|
||||
// If all of the demanded bits are known one on one side, return the other.
|
||||
// These bits cannot contribute to the result of the 'and'.
|
||||
@ -633,11 +633,11 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
||||
case ISD::OR:
|
||||
if (SimplifyDemandedBits(Op.getOperand(1), NewMask, Known, TLO, Depth+1))
|
||||
return true;
|
||||
assert((Known.Zero & Known.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
if (SimplifyDemandedBits(Op.getOperand(0), ~Known.One & NewMask,
|
||||
Known2, TLO, Depth+1))
|
||||
return true;
|
||||
assert((Known2.Zero & Known2.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert(!Known2.hasConflict() && "Bits known to be one AND zero?");
|
||||
|
||||
// If all of the demanded bits are known zero on one side, return the other.
|
||||
// These bits cannot contribute to the result of the 'or'.
|
||||
@ -660,10 +660,10 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
||||
case ISD::XOR: {
|
||||
if (SimplifyDemandedBits(Op.getOperand(1), NewMask, Known, TLO, Depth+1))
|
||||
return true;
|
||||
assert((Known.Zero & Known.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
if (SimplifyDemandedBits(Op.getOperand(0), NewMask, Known2, TLO, Depth+1))
|
||||
return true;
|
||||
assert((Known2.Zero & Known2.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert(!Known2.hasConflict() && "Bits known to be one AND zero?");
|
||||
|
||||
// If all of the demanded bits are known zero on one side, return the other.
|
||||
// These bits cannot contribute to the result of the 'xor'.
|
||||
@ -725,8 +725,8 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
||||
return true;
|
||||
if (SimplifyDemandedBits(Op.getOperand(1), NewMask, Known2, TLO, Depth+1))
|
||||
return true;
|
||||
assert((Known.Zero & Known.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert((Known2.Zero & Known2.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
assert(!Known2.hasConflict() && "Bits known to be one AND zero?");
|
||||
|
||||
// If the operands are constants, see if we can simplify them.
|
||||
if (ShrinkDemandedConstant(Op, NewMask, TLO))
|
||||
@ -741,8 +741,8 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
||||
return true;
|
||||
if (SimplifyDemandedBits(Op.getOperand(2), NewMask, Known2, TLO, Depth+1))
|
||||
return true;
|
||||
assert((Known.Zero & Known.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert((Known2.Zero & Known2.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
assert(!Known2.hasConflict() && "Bits known to be one AND zero?");
|
||||
|
||||
// If the operands are constants, see if we can simplify them.
|
||||
if (ShrinkDemandedConstant(Op, NewMask, TLO))
|
||||
@ -907,7 +907,7 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
||||
// Compute the new bits that are at the top now.
|
||||
if (SimplifyDemandedBits(InOp, InDemandedMask, Known, TLO, Depth+1))
|
||||
return true;
|
||||
assert((Known.Zero & Known.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
Known.Zero.lshrInPlace(ShAmt);
|
||||
Known.One.lshrInPlace(ShAmt);
|
||||
|
||||
@ -947,7 +947,7 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
||||
if (SimplifyDemandedBits(Op.getOperand(0), InDemandedMask, Known, TLO,
|
||||
Depth+1))
|
||||
return true;
|
||||
assert((Known.Zero & Known.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
Known.Zero.lshrInPlace(ShAmt);
|
||||
Known.One.lshrInPlace(ShAmt);
|
||||
|
||||
@ -1029,7 +1029,7 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
||||
if (SimplifyDemandedBits(Op.getOperand(0), InputDemandedBits,
|
||||
Known, TLO, Depth+1))
|
||||
return true;
|
||||
assert((Known.Zero & Known.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
|
||||
// If the sign bit of the input is known set or clear, then we know the
|
||||
// top bits of the result.
|
||||
@ -1084,7 +1084,7 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
||||
|
||||
if (SimplifyDemandedBits(Op.getOperand(0), InMask, Known, TLO, Depth+1))
|
||||
return true;
|
||||
assert((Known.Zero & Known.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
Known = Known.zext(BitWidth);
|
||||
Known.Zero |= NewBits;
|
||||
break;
|
||||
@ -1134,7 +1134,7 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
||||
APInt InMask = NewMask.trunc(OperandBitWidth);
|
||||
if (SimplifyDemandedBits(Op.getOperand(0), InMask, Known, TLO, Depth+1))
|
||||
return true;
|
||||
assert((Known.Zero & Known.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
Known = Known.zext(BitWidth);
|
||||
break;
|
||||
}
|
||||
@ -1193,7 +1193,7 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
||||
}
|
||||
}
|
||||
|
||||
assert((Known.Zero & Known.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
break;
|
||||
}
|
||||
case ISD::AssertZext: {
|
||||
@ -1205,7 +1205,7 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
||||
if (SimplifyDemandedBits(Op.getOperand(0), ~InMask | NewMask,
|
||||
Known, TLO, Depth+1))
|
||||
return true;
|
||||
assert((Known.Zero & Known.One) == 0 && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
|
||||
Known.Zero |= ~InMask;
|
||||
break;
|
||||
|
@ -158,8 +158,8 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
|
||||
SimplifyDemandedBits(I, 0, DemandedMask & ~RHSKnown.Zero, LHSKnown,
|
||||
Depth + 1))
|
||||
return I;
|
||||
assert(!(RHSKnown.Zero & RHSKnown.One) && "Bits known to be one AND zero?");
|
||||
assert(!(LHSKnown.Zero & LHSKnown.One) && "Bits known to be one AND zero?");
|
||||
assert(!RHSKnown.hasConflict() && "Bits known to be one AND zero?");
|
||||
assert(!LHSKnown.hasConflict() && "Bits known to be one AND zero?");
|
||||
|
||||
// Output known-0 are known to be clear if zero in either the LHS | RHS.
|
||||
APInt IKnownZero = RHSKnown.Zero | LHSKnown.Zero;
|
||||
@ -192,8 +192,8 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
|
||||
SimplifyDemandedBits(I, 0, DemandedMask & ~RHSKnown.One, LHSKnown,
|
||||
Depth + 1))
|
||||
return I;
|
||||
assert(!(RHSKnown.Zero & RHSKnown.One) && "Bits known to be one AND zero?");
|
||||
assert(!(LHSKnown.Zero & LHSKnown.One) && "Bits known to be one AND zero?");
|
||||
assert(!RHSKnown.hasConflict() && "Bits known to be one AND zero?");
|
||||
assert(!LHSKnown.hasConflict() && "Bits known to be one AND zero?");
|
||||
|
||||
// Output known-0 bits are only known if clear in both the LHS & RHS.
|
||||
APInt IKnownZero = RHSKnown.Zero & LHSKnown.Zero;
|
||||
@ -224,8 +224,8 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
|
||||
if (SimplifyDemandedBits(I, 1, DemandedMask, RHSKnown, Depth + 1) ||
|
||||
SimplifyDemandedBits(I, 0, DemandedMask, LHSKnown, Depth + 1))
|
||||
return I;
|
||||
assert(!(RHSKnown.Zero & RHSKnown.One) && "Bits known to be one AND zero?");
|
||||
assert(!(LHSKnown.Zero & LHSKnown.One) && "Bits known to be one AND zero?");
|
||||
assert(!RHSKnown.hasConflict() && "Bits known to be one AND zero?");
|
||||
assert(!LHSKnown.hasConflict() && "Bits known to be one AND zero?");
|
||||
|
||||
// Output known-0 bits are known if clear or set in both the LHS & RHS.
|
||||
APInt IKnownZero = (RHSKnown.Zero & LHSKnown.Zero) |
|
||||
@ -313,8 +313,8 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
|
||||
if (SimplifyDemandedBits(I, 2, DemandedMask, RHSKnown, Depth + 1) ||
|
||||
SimplifyDemandedBits(I, 1, DemandedMask, LHSKnown, Depth + 1))
|
||||
return I;
|
||||
assert(!(RHSKnown.Zero & RHSKnown.One) && "Bits known to be one AND zero?");
|
||||
assert(!(LHSKnown.Zero & LHSKnown.One) && "Bits known to be one AND zero?");
|
||||
assert(!RHSKnown.hasConflict() && "Bits known to be one AND zero?");
|
||||
assert(!LHSKnown.hasConflict() && "Bits known to be one AND zero?");
|
||||
|
||||
// If the operands are constants, see if we can simplify them.
|
||||
if (ShrinkDemandedConstant(I, 1, DemandedMask) ||
|
||||
@ -333,7 +333,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
|
||||
return I;
|
||||
DemandedMask = DemandedMask.trunc(BitWidth);
|
||||
Known = Known.trunc(BitWidth);
|
||||
assert(!(Known.Zero & Known.One) && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
break;
|
||||
}
|
||||
case Instruction::BitCast:
|
||||
@ -355,7 +355,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
|
||||
|
||||
if (SimplifyDemandedBits(I, 0, DemandedMask, Known, Depth + 1))
|
||||
return I;
|
||||
assert(!(Known.Zero & Known.One) && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
break;
|
||||
case Instruction::ZExt: {
|
||||
// Compute the bits in the result that are not present in the input.
|
||||
@ -367,7 +367,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
|
||||
return I;
|
||||
DemandedMask = DemandedMask.zext(BitWidth);
|
||||
Known = Known.zext(BitWidth);
|
||||
assert(!(Known.Zero & Known.One) && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
// The top bits are known to be zero.
|
||||
Known.Zero.setBitsFrom(SrcBitWidth);
|
||||
break;
|
||||
@ -391,7 +391,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
|
||||
return I;
|
||||
InputDemandedBits = InputDemandedBits.zext(BitWidth);
|
||||
Known = Known.zext(BitWidth);
|
||||
assert(!(Known.Zero & Known.One) && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
|
||||
// If the sign bit of the input is known set or clear, then we know the
|
||||
// top bits of the result.
|
||||
@ -467,7 +467,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
|
||||
|
||||
if (SimplifyDemandedBits(I, 0, DemandedMaskIn, Known, Depth + 1))
|
||||
return I;
|
||||
assert(!(Known.Zero & Known.One) && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
Known.Zero <<= ShiftAmt;
|
||||
Known.One <<= ShiftAmt;
|
||||
// low bits known zero.
|
||||
@ -491,7 +491,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
|
||||
|
||||
if (SimplifyDemandedBits(I, 0, DemandedMaskIn, Known, Depth + 1))
|
||||
return I;
|
||||
assert(!(Known.Zero & Known.One) && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
Known.Zero.lshrInPlace(ShiftAmt);
|
||||
Known.One.lshrInPlace(ShiftAmt);
|
||||
if (ShiftAmt)
|
||||
@ -535,7 +535,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
|
||||
if (SimplifyDemandedBits(I, 0, DemandedMaskIn, Known, Depth + 1))
|
||||
return I;
|
||||
|
||||
assert(!(Known.Zero & Known.One) && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
// Compute the new bits that are at the top now.
|
||||
APInt HighBits(APInt::getHighBitsSet(BitWidth, ShiftAmt));
|
||||
Known.Zero.lshrInPlace(ShiftAmt);
|
||||
@ -590,7 +590,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
|
||||
if (LHSKnown.isNegative() && LowBits.intersects(LHSKnown.One))
|
||||
Known.One |= ~LowBits;
|
||||
|
||||
assert(!(Known.Zero & Known.One) && "Bits known to be one AND zero?");
|
||||
assert(!Known.hasConflict() && "Bits known to be one AND zero?");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user