[llvm-commits] [llvm] r52041 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Zhou Sheng
zhousheng00 at gmail.com
Fri Jun 6 01:32:06 PDT 2008
Author: sheng
Date: Fri Jun 6 03:32:05 2008
New Revision: 52041
URL: http://llvm.org/viewvc/llvm-project?rev=52041&view=rev
Log:
As Chris suggested, handle the situation if ShAmt larger than BitWidth,
otherwise, opt might crash.
Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=52041&r1=52040&r2=52041&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Fri Jun 6 03:32:05 2008
@@ -1236,7 +1236,7 @@
// 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(
More information about the llvm-commits
mailing list