1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

As Chris suggested, handle the situation if ShAmt larger than BitWidth,

otherwise, opt might crash.

llvm-svn: 52041
This commit is contained in:
Zhou Sheng 2008-06-06 08:32:05 +00:00
parent fe06a1fd5b
commit 06fc769e52

View File

@ -1236,7 +1236,7 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, APInt DemandedMask,
// If the input sign bit is known to be zero, or if none of the top bits // If the input sign bit is known to be zero, or if none of the top bits
// are demanded, turn this into an unsigned shift right. // are demanded, turn this into an unsigned shift right.
if (BitWidth == ShiftAmt || RHSKnownZero[BitWidth-ShiftAmt-1] || if (BitWidth <= ShiftAmt || RHSKnownZero[BitWidth-ShiftAmt-1] ||
(HighBits & ~DemandedMask) == HighBits) { (HighBits & ~DemandedMask) == HighBits) {
// Perform the logical shift right. // Perform the logical shift right.
Value *NewVal = BinaryOperator::CreateLShr( Value *NewVal = BinaryOperator::CreateLShr(