[DAG] GetDemandedBits - don't bother asserting for a non-null cast<> result. NFC.

cast<> will assert on failure anyhow.

This lets us fold the cast<> with the getAPIntValue() that uses it.
This commit is contained in:
Simon Pilgrim 2020-06-03 12:30:27 +01:00
parent a2f32bfcc7
commit c438b257f1
1 changed files with 1 additions and 3 deletions

View File

@ -2195,9 +2195,7 @@ SDValue SelectionDAG::GetDemandedBits(SDValue V, const APInt &DemandedBits,
*this, 0); *this, 0);
break; break;
case ISD::Constant: { case ISD::Constant: {
auto *CV = cast<ConstantSDNode>(V.getNode()); const APInt &CVal = cast<ConstantSDNode>(V)->getAPIntValue();
assert(CV && "Const value should be ConstSDNode.");
const APInt &CVal = CV->getAPIntValue();
APInt NewVal = CVal & DemandedBits; APInt NewVal = CVal & DemandedBits;
if (NewVal != CVal) if (NewVal != CVal)
return getConstant(NewVal, SDLoc(V), V.getValueType()); return getConstant(NewVal, SDLoc(V), V.getValueType());