1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

Just mark the sign bit as known zero, rather than any other irrelevant bits

known zero in the LHS.  Fixes PR12541.

llvm-svn: 155818
This commit is contained in:
Duncan Sands 2012-04-30 11:56:58 +00:00
parent 5a1a6421ca
commit 8fa4166239
2 changed files with 13 additions and 1 deletions

View File

@ -564,7 +564,7 @@ void llvm::ComputeMaskedBits(Value *V, APInt &KnownZero, APInt &KnownOne,
Depth+1);
// If it's known zero, our sign bit is also zero.
if (LHSKnownZero.isNegative())
KnownZero |= LHSKnownZero;
KnownZero.setBit(BitWidth - 1);
}
break;

View File

@ -0,0 +1,12 @@
; RUN: opt -instcombine -S < %s | FileCheck %s
; PR12541
define i32 @foo(i32 %x) {
%y = xor i32 %x, 3
%z = srem i32 1656690544, %y
%sext = shl i32 %z, 24
%s = ashr exact i32 %sext, 24
ret i32 %s
; CHECK-NOT: and
; The shifts were wrongly being turned into an and with 112
}