PR7586: Make sure we don't claim that unknown bits are actually known in the
authorEli Friedman <eli.friedman@gmail.com>
Mon, 2 Aug 2010 04:42:25 +0000 (04:42 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Mon, 2 Aug 2010 04:42:25 +0000 (04:42 +0000)
ISD::AND case of TargetLowering::SimplifyDemandedBits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110019 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/TargetLowering.cpp

index 908a9d8919ddb0fd79e9cdd711d10bb7606f4117..9772d55449e9b1ad616369128c8630718c946180 100644 (file)
@@ -1497,11 +1497,10 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
     // present in the input.
     APInt NewBits =
       APInt::getHighBitsSet(BitWidth,
-                            BitWidth - EVT.getScalarType().getSizeInBits()) &
-      NewMask;
+                            BitWidth - EVT.getScalarType().getSizeInBits());
     
     // If none of the extended bits are demanded, eliminate the sextinreg.
-    if (NewBits == 0)
+    if ((NewBits & NewMask) == 0)
       return TLO.CombineTo(Op, Op.getOperand(0));
 
     APInt InSignBit = APInt::getSignBit(EVT.getScalarType().getSizeInBits());