Commit e8a900fc authored by Bill Wendling's avatar Bill Wendling
Browse files

Merging r155818:

------------------------------------------------------------------------
r155818 | baldrick | 2012-04-30 04:56:58 -0700 (Mon, 30 Apr 2012) | 3 lines

Just mark the sign bit as known zero, rather than any other irrelevant bits
known zero in the LHS.  Fixes PR12541.

------------------------------------------------------------------------

llvm-svn: 155827
parent 2fe44613
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
+12 −0
Original line number Diff line number Diff line
; 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
}