[llvm] df0c16c - [NFC][DAGCombine] Use isOperandOf() in combineCarryDiamond
Paweł Bylica via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 21 12:41:46 PST 2022
Author: Paweł Bylica
Date: 2022-02-21T21:41:31+01:00
New Revision: df0c16ce00629dd55d85ece34403535c39c1da9d
URL: https://github.com/llvm/llvm-project/commit/df0c16ce00629dd55d85ece34403535c39c1da9d
DIFF: https://github.com/llvm/llvm-project/commit/df0c16ce00629dd55d85ece34403535c39c1da9d.diff
LOG: [NFC][DAGCombine] Use isOperandOf() in combineCarryDiamond
Pre-commit for https://reviews.llvm.org/D118362.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 3196ba9f7689d..6c5286277ba9d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -3146,12 +3146,12 @@ static SDValue combineCarryDiamond(SelectionDAG &DAG, const TargetLowering &TLI,
if (Opcode != ISD::UADDO && Opcode != ISD::USUBO)
return SDValue();
- // Canonicalize the add/sub of A and B as Carry0 and the add/sub of the
- // carry/borrow in as Carry1. (The top and middle uaddo nodes respectively in
- // the above ASCII art.)
- if (Carry1.getOperand(0) != Carry0.getValue(0) &&
- Carry1.getOperand(1) != Carry0.getValue(0))
+ // Canonicalize the add/sub of A and B (the top node in the above ASCII art)
+ // as Carry0 and the add/sub of the carry in as Carry1 (the middle node).
+ if (Carry1.getNode()->isOperandOf(Carry0.getNode()))
std::swap(Carry0, Carry1);
+
+ // Check if nodes are connected in expected way.
if (Carry1.getOperand(0) != Carry0.getValue(0) &&
Carry1.getOperand(1) != Carry0.getValue(0))
return SDValue();
More information about the llvm-commits
mailing list