Skip to content

Commit 76be1a8

Browse files
authored
[RISCV] Avoid recreating constants in LowerSelect [nfc] (#155628)
1 parent c7d1425 commit 76be1a8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9301,12 +9301,10 @@ SDValue RISCVTargetLowering::lowerSELECT(SDValue Op, SelectionDAG &DAG) const {
93019301
getCost(TrueVal - FalseVal, FalseVal);
93029302
SDValue LHSVal = DAG.getConstant(
93039303
IsCZERO_NEZ ? FalseVal - TrueVal : TrueVal - FalseVal, DL, VT);
9304-
SDValue RHSVal =
9305-
DAG.getConstant(IsCZERO_NEZ ? TrueVal : FalseVal, DL, VT);
93069304
SDValue CMOV =
93079305
DAG.getNode(IsCZERO_NEZ ? RISCVISD::CZERO_NEZ : RISCVISD::CZERO_EQZ,
93089306
DL, VT, LHSVal, CondV);
9309-
return DAG.getNode(ISD::ADD, DL, VT, CMOV, RHSVal);
9307+
return DAG.getNode(ISD::ADD, DL, VT, CMOV, IsCZERO_NEZ ? TrueV : FalseV);
93109308
}
93119309

93129310
// (select c, c1, t) -> (add (czero_nez t - c1, c), c1)

0 commit comments

Comments
 (0)