Skip to content

Commit 6915c76

Browse files
committed
[RISCV] Don't use DCI.CombineTo to replace a single result. NFCI
Just return the new node, which is the standard practice. I also noticed what appeared to be an unnecessary attempt at creating an ANY_EXTEND where the type should already be correct. I replace with an assert to verify the type. Differential Revision: https://reviews.llvm.org/D90444
1 parent 4348e0e commit 6915c76

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,9 +1086,9 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
10861086
// conversion is unnecessary and can be replaced with an ANY_EXTEND
10871087
// of the FMV_W_X_RV64 operand.
10881088
if (Op0->getOpcode() == RISCVISD::FMV_W_X_RV64) {
1089-
SDValue AExtOp =
1090-
DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i64, Op0.getOperand(0));
1091-
return DCI.CombineTo(N, AExtOp);
1089+
assert(Op0.getOperand(0).getValueType() == MVT::i64 &&
1090+
"Unexpected value type!");
1091+
return Op0.getOperand(0);
10921092
}
10931093

10941094
// This is a target-specific version of a DAGCombine performed in
@@ -1101,15 +1101,13 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
11011101
SDValue NewFMV = DAG.getNode(RISCVISD::FMV_X_ANYEXTW_RV64, DL, MVT::i64,
11021102
Op0.getOperand(0));
11031103
APInt SignBit = APInt::getSignMask(32).sext(64);
1104-
if (Op0.getOpcode() == ISD::FNEG) {
1105-
return DCI.CombineTo(N,
1106-
DAG.getNode(ISD::XOR, DL, MVT::i64, NewFMV,
1107-
DAG.getConstant(SignBit, DL, MVT::i64)));
1108-
}
1104+
if (Op0.getOpcode() == ISD::FNEG)
1105+
return DAG.getNode(ISD::XOR, DL, MVT::i64, NewFMV,
1106+
DAG.getConstant(SignBit, DL, MVT::i64));
1107+
11091108
assert(Op0.getOpcode() == ISD::FABS);
1110-
return DCI.CombineTo(N,
1111-
DAG.getNode(ISD::AND, DL, MVT::i64, NewFMV,
1112-
DAG.getConstant(~SignBit, DL, MVT::i64)));
1109+
return DAG.getNode(ISD::AND, DL, MVT::i64, NewFMV,
1110+
DAG.getConstant(~SignBit, DL, MVT::i64));
11131111
}
11141112
}
11151113

0 commit comments

Comments
 (0)