[llvm-commits] [llvm] r47098 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Dan Gohman gohman at apple.com
Wed Feb 13 14:43:25 PST 2008


Author: djg
Date: Wed Feb 13 16:43:25 2008
New Revision: 47098

URL: http://llvm.org/viewvc/llvm-project?rev=47098&view=rev
Log:
Avoid setting bits that aren't demanded.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=47098&r1=47097&r2=47098&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Feb 13 16:43:25 2008
@@ -1237,7 +1237,7 @@
       KnownZero = KnownZero.lshr(ShAmt);
       KnownOne  = KnownOne.lshr(ShAmt);
 
-      APInt HighBits = APInt::getHighBitsSet(BitWidth, ShAmt);
+      APInt HighBits = APInt::getHighBitsSet(BitWidth, ShAmt) & Mask;
       KnownZero |= HighBits;  // High bits known zero.
     }
     return;
@@ -1248,8 +1248,8 @@
       APInt InDemandedMask = (Mask << ShAmt);
       // If any of the demanded bits are produced by the sign extension, we also
       // demand the input sign bit.
-      APInt HighBits = APInt::getHighBitsSet(BitWidth, ShAmt);
-      if (!!(HighBits & Mask))
+      APInt HighBits = APInt::getHighBitsSet(BitWidth, ShAmt) & Mask;
+      if (HighBits.getBoolValue())
         InDemandedMask |= APInt::getSignBit(BitWidth);
       
       ComputeMaskedBits(Op.getOperand(0), InDemandedMask, KnownZero, KnownOne,





More information about the llvm-commits mailing list