Skip to content

Commit a87b839

Browse files
committed
[RISCV] Simplify conversion from ISD::Constant to ISD::TargetConstant in SelectAddrRegRegScale. NFC
Directly copy the underlying ConstantInt instead of reconstructing it.
1 parent 36e4174 commit a87b839

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3064,8 +3064,8 @@ bool RISCVDAGToDAGISel::SelectAddrRegRegScale(SDValue Addr,
30643064
!isa<ConstantSDNode>(AddrB.getOperand(1)) &&
30653065
isInt<12>(C1->getSExtValue())) {
30663066
// (add (add (shl A C2) B) C1) -> (add (add B C1) (shl A C2))
3067-
SDValue C1Val =
3068-
CurDAG->getTargetConstant(C1->getZExtValue(), SDLoc(Addr), VT);
3067+
SDValue C1Val = CurDAG->getTargetConstant(*C1->getConstantIntValue(),
3068+
SDLoc(Addr), VT);
30693069
Base = SDValue(CurDAG->getMachineNode(RISCV::ADDI, SDLoc(Addr), VT,
30703070
AddrB.getOperand(1), C1Val),
30713071
0);

0 commit comments

Comments
 (0)