[llvm-commits] [llvm] r52003 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
clattner at apple.com
Thu Jun 5 09:40:15 PDT 2008
On Jun 5, 2008, at 7:23 AM, Zhou Sheng wrote:
> Author: sheng
> Date: Thu Jun 5 09:23:44 2008
> New Revision: 52003
>
> URL: http://llvm.org/viewvc/llvm-project?rev=52003&view=rev
> Log:
> If BitWidth equals to ShtAmt, the RHSKnownZero[BitWidth-ShiftAmt-1]
> will
> crash the opt. Just fix this.
Hi Sheng,
What happens if ShiftAmt is larger? Shifting by the bitwidth or more
is undefined... maybe this should be caught earlier?
-Chris
>
>
> Test case in llvm/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll
>
> 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=52003&r1=52002&r2=52003&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
> (original)
> +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu
> Jun 5 09:23:44 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 (RHSKnownZero[BitWidth-ShiftAmt-1] ||
> + if (BitWidth == ShiftAmt || RHSKnownZero[BitWidth-ShiftAmt-1]
> ||
> (HighBits & ~DemandedMask) == HighBits) {
> // Perform the logical shift right.
> Value *NewVal = BinaryOperator::CreateLShr(
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list