Skip to content

Commit 5143818

Browse files
committed
[RISCV] Move hasOneUse() call after opcode check.
hasOneUse can be more expensive for nodes with multiple outputs. It's better to check the opcode first to skip nodes with multiple outputs. I have not seen an issue from this, just noticed while reviewing code for a possible enhancement.
1 parent ece5dd1 commit 5143818

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11999,7 +11999,7 @@ static SDValue performXORCombine(SDNode *N, SelectionDAG &DAG,
1199911999
}
1200012000

1200112001
// Fold (xor (setcc constant, y, setlt), 1) -> (setcc y, constant + 1, setlt)
12002-
if (N0.hasOneUse() && N0.getOpcode() == ISD::SETCC && isOneConstant(N1)) {
12002+
if (N0.getOpcode() == ISD::SETCC && isOneConstant(N1) && N0.hasOneUse()) {
1200312003
auto *ConstN00 = dyn_cast<ConstantSDNode>(N0.getOperand(0));
1200412004
ISD::CondCode CC = cast<CondCodeSDNode>(N0.getOperand(2))->get();
1200512005
if (ConstN00 && CC == ISD::SETLT) {

0 commit comments

Comments
 (0)