[llvm] 420420d - [DAG] Avoid APInt copies by directly using the APInt reference from getAPIntValue. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 16 05:53:00 PST 2021
Author: Simon Pilgrim
Date: 2021-02-16T13:50:34Z
New Revision: 420420de57ccbd78805ed86df49b6c19088f99c4
URL: https://github.com/llvm/llvm-project/commit/420420de57ccbd78805ed86df49b6c19088f99c4
DIFF: https://github.com/llvm/llvm-project/commit/420420de57ccbd78805ed86df49b6c19088f99c4.diff
LOG: [DAG] Avoid APInt copies by directly using the APInt reference from getAPIntValue. NFCI.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index eae4c4a7b394..6fd14a35ac97 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -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;
More information about the llvm-commits
mailing list