Implement MaskedValueIsZero for ANY_EXTEND nodes
[oota-llvm.git] / lib / CodeGen / SelectionDAG / TargetLowering.cpp
index c861762d16db5d70a220bb9562138efaa1ee0633..c79045b8859ee9521e20df13c9f70311a28f7ff8 100644 (file)
@@ -154,6 +154,11 @@ bool TargetLowering::MaskedValueIsZero(const SDOperand &Op,
   case ISD::ZERO_EXTEND:
     SrcBits = MVT::getSizeInBits(Op.getOperand(0).getValueType());
     return MaskedValueIsZero(Op.getOperand(0),Mask & (~0ULL >> (64-SrcBits)));
+  case ISD::ANY_EXTEND:
+    // If the mask only includes bits in the low part, recurse.
+    SrcBits = MVT::getSizeInBits(Op.getOperand(0).getValueType());
+    if (Mask >> SrcBits) return false;  // Use of unknown top bits.
+    return MaskedValueIsZero(Op.getOperand(0), Mask);
   case ISD::AssertZext:
     SrcBits = MVT::getSizeInBits(cast<VTSDNode>(Op.getOperand(1))->getVT());
     return (Mask & ((1ULL << SrcBits)-1)) == 0; // Returning only the zext bits.