summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorZhou Sheng <zhousheng00@gmail.com>2008-06-06 08:32:05 +0000
committerZhou Sheng <zhousheng00@gmail.com>2008-06-06 08:32:05 +0000
commit1152ca9101388e247450bfef72c90ca92d163f0d (patch)
treee936989a876b1d9311258d1de7e5e3bbbbbf91b3 /llvm/lib/Transforms
parent6d7a144453974857121c2588ee7e91bcaa2b4ffd (diff)
downloadbcm5719-llvm-1152ca9101388e247450bfef72c90ca92d163f0d.tar.gz
bcm5719-llvm-1152ca9101388e247450bfef72c90ca92d163f0d.zip
As Chris suggested, handle the situation if ShAmt larger than BitWidth,
otherwise, opt might crash. llvm-svn: 52041
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 05e12692f4c..67c40fe21c9 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -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
// 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) {
// Perform the logical shift right.
Value *NewVal = BinaryOperator::CreateLShr(
OpenPOWER on IntegriCloud