mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-29 13:32:33 +00:00
If BitWidth equals to ShtAmt, the RHSKnownZero[BitWidth-ShiftAmt-1] will
crash the opt. Just fix this. Test case in llvm/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52003 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
411e6a5efb
commit
17183ab973
@ -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 (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(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user