Skip to content

Commit d01e1c1

Browse files
authored
[RISCV] Use getNegative instead of subtracting from zero. NFC (#162313)
1 parent 96e0bbc commit d01e1c1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15721,8 +15721,7 @@ static SDValue combineAddOfBooleanXor(SDNode *N, SelectionDAG &DAG) {
1572115721
return SDValue();
1572215722

1572315723
// Emit a negate of the setcc.
15724-
return DAG.getNode(ISD::SUB, DL, VT, DAG.getConstant(0, DL, VT),
15725-
N0.getOperand(0));
15724+
return DAG.getNegative(N0.getOperand(0), DL, VT);
1572615725
}
1572715726

1572815727
static SDValue performADDCombine(SDNode *N,
@@ -16974,7 +16973,7 @@ performSIGN_EXTEND_INREGCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI,
1697416973

1697516974
// Fold (sext_inreg (setcc), i1) -> (sub 0, (setcc))
1697616975
if (Opc == ISD::SETCC && SrcVT == MVT::i1 && DCI.isAfterLegalizeDAG())
16977-
return DAG.getNode(ISD::SUB, DL, VT, DAG.getConstant(0, DL, VT), Src);
16976+
return DAG.getNegative(Src, DL, VT);
1697816977

1697916978
// Fold (sext_inreg (xor (setcc), -1), i1) -> (add (setcc), -1)
1698016979
if (Opc == ISD::XOR && SrcVT == MVT::i1 &&

0 commit comments

Comments
 (0)