[DAG] Avoid APInt copies by directly using the APInt reference from getAPIntValue. NFCI.

This commit is contained in:
Simon Pilgrim 2021-02-16 12:40:10 +00:00
parent dd879f7dc9
commit 420420de57
1 changed files with 4 additions and 4 deletions

View File

@ -5315,8 +5315,8 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
assert(N1.getValueType() == N2.getValueType() &&
N1.getValueType() == VT && "Binary operator types must match!");
if (N2C && (N1.getOpcode() == ISD::VSCALE) && Flags.hasNoSignedWrap()) {
APInt MulImm = cast<ConstantSDNode>(N1->getOperand(0))->getAPIntValue();
APInt N2CImm = N2C->getAPIntValue();
const APInt &MulImm = N1->getConstantOperandAPInt(0);
const APInt &N2CImm = N2C->getAPIntValue();
return getVScale(DL, VT, MulImm * N2CImm);
}
break;
@ -5369,8 +5369,8 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
break;
case ISD::SHL:
if (N2C && (N1.getOpcode() == ISD::VSCALE) && Flags.hasNoSignedWrap()) {
APInt MulImm = cast<ConstantSDNode>(N1->getOperand(0))->getAPIntValue();
APInt ShiftImm = N2C->getAPIntValue();
const APInt &MulImm = N1->getConstantOperandAPInt(0);
const APInt &ShiftImm = N2C->getAPIntValue();
return getVScale(DL, VT, MulImm << ShiftImm);
}
LLVM_FALLTHROUGH;