unsigned BitWidth = Op.getScalarValueSizeInBits();
Known = KnownBits(BitWidth); // Don't know anything.
+
+ if (auto *C = dyn_cast<ConstantSDNode>(Op)) {
+ // We know all of the bits for a constant!
+ Known.One = C->getAPIntValue();
+ Known.Zero = ~Known.One;
+ return;
+ }
+
if (Depth == 6)
return; // Limit search depth.
unsigned Opcode = Op.getOpcode();
switch (Opcode) {
- case ISD::Constant:
- // We know all of the bits for a constant!
- Known.One = cast<ConstantSDNode>(Op)->getAPIntValue();
- Known.Zero = ~Known.One;
- break;
case ISD::BUILD_VECTOR:
// Collect the known bits that are shared by every demanded vector element.
assert(NumElts == Op.getValueType().getVectorNumElements() &&
unsigned Tmp, Tmp2;
unsigned FirstAnswer = 1;
+ if (auto *C = dyn_cast<ConstantSDNode>(Op)) {
+ const APInt &Val = cast<ConstantSDNode>(Op)->getAPIntValue();
+ return Val.getNumSignBits();
+ }
+
if (Depth == 6)
return 1; // Limit search depth.
Tmp = cast<VTSDNode>(Op.getOperand(1))->getVT().getSizeInBits();
return VTBits-Tmp;
- case ISD::Constant: {
- const APInt &Val = cast<ConstantSDNode>(Op)->getAPIntValue();
- return Val.getNumSignBits();
- }
-
case ISD::BUILD_VECTOR:
Tmp = VTBits;
for (unsigned i = 0, e = Op.getNumOperands(); (i < e) && (Tmp > 1); ++i) {