forked from OSchip/llvm-project
For expression like
"APInt::getAllOnesValue(ShiftAmt).zextOrCopy(BitWidth)", to handle ShiftAmt == BitWidth situation, use zextOrCopy() instead of zext(). llvm-svn: 35080
This commit is contained in:
parent
b9c3707e97
commit
ebe634e662
|
@ -1995,7 +1995,7 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, APInt DemandedMask,
|
||||||
RHSKnownZero <<= ShiftAmt;
|
RHSKnownZero <<= ShiftAmt;
|
||||||
RHSKnownOne <<= ShiftAmt;
|
RHSKnownOne <<= ShiftAmt;
|
||||||
// low bits known zero.
|
// low bits known zero.
|
||||||
RHSKnownZero |= APInt::getAllOnesValue(ShiftAmt).zext(BitWidth);
|
RHSKnownZero |= APInt::getAllOnesValue(ShiftAmt).zextOrCopy(BitWidth);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Instruction::LShr:
|
case Instruction::LShr:
|
||||||
|
@ -2012,7 +2012,7 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, APInt DemandedMask,
|
||||||
assert((RHSKnownZero & RHSKnownOne) == 0 &&
|
assert((RHSKnownZero & RHSKnownOne) == 0 &&
|
||||||
"Bits known to be one AND zero?");
|
"Bits known to be one AND zero?");
|
||||||
// Compute the new bits that are at the top now.
|
// Compute the new bits that are at the top now.
|
||||||
APInt HighBits(APInt::getAllOnesValue(ShiftAmt).zext(BitWidth).shl(
|
APInt HighBits(APInt::getAllOnesValue(ShiftAmt).zextOrCopy(BitWidth).shl(
|
||||||
BitWidth - ShiftAmt));
|
BitWidth - ShiftAmt));
|
||||||
RHSKnownZero &= TypeMask;
|
RHSKnownZero &= TypeMask;
|
||||||
RHSKnownOne &= TypeMask;
|
RHSKnownOne &= TypeMask;
|
||||||
|
@ -2046,7 +2046,7 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, APInt DemandedMask,
|
||||||
assert((RHSKnownZero & RHSKnownOne) == 0 &&
|
assert((RHSKnownZero & RHSKnownOne) == 0 &&
|
||||||
"Bits known to be one AND zero?");
|
"Bits known to be one AND zero?");
|
||||||
// Compute the new bits that are at the top now.
|
// Compute the new bits that are at the top now.
|
||||||
APInt HighBits(APInt::getAllOnesValue(ShiftAmt).zext(BitWidth).shl(
|
APInt HighBits(APInt::getAllOnesValue(ShiftAmt).zextOrCopy(BitWidth).shl(
|
||||||
BitWidth - ShiftAmt));
|
BitWidth - ShiftAmt));
|
||||||
RHSKnownZero &= TypeMask;
|
RHSKnownZero &= TypeMask;
|
||||||
RHSKnownOne &= TypeMask;
|
RHSKnownOne &= TypeMask;
|
||||||
|
|
Loading…
Reference in New Issue