}
auto OpIsZero = [N](size_t OpNo) {
- if (ConstantSDNode *OpConst = dyn_cast<ConstantSDNode>(N->getOperand(OpNo)))
- if (OpConst->getZExtValue() == 0)
- return true;
- return false;
+ return isNullConstant(N->getOperand(OpNo));
};
// If the input accumulator value is not zero, select an instruction with
SDValue SmulLoHi = N->getOperand(1);
SDValue Subc = N->getOperand(2);
- auto *Zero = dyn_cast<ConstantSDNode>(Subc.getOperand(0));
+ SDValue Zero = Subc.getOperand(0);
- if (!Zero || Zero->getZExtValue() != 0 ||
- Subc.getOperand(1) != SmulLoHi.getValue(0) ||
+ if (!isNullConstant(Zero) || Subc.getOperand(1) != SmulLoHi.getValue(0) ||
N->getOperand(1) != SmulLoHi.getValue(1) ||
N->getOperand(2) != Subc.getValue(1))
break;
break;
case RTLIB::MEMSET:
AEABILibcall = AEABI_MEMSET;
- if (ConstantSDNode *ConstantSrc = dyn_cast<ConstantSDNode>(Src))
- if (ConstantSrc->getZExtValue() == 0)
- AEABILibcall = AEABI_MEMCLR;
+ if (isNullConstant(Src))
+ AEABILibcall = AEABI_MEMCLR;
break;
default:
return SDValue();