[llvm] 43a969d - [X86] combineADC - pull out repeated dyn_cast<ConstantSDNode> calls. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 25 05:53:19 PDT 2022
Author: Simon Pilgrim
Date: 2022-03-25T12:53:08Z
New Revision: 43a969debdd86ea96ea4998caa5c9b6b4c59dd7c
URL: https://github.com/llvm/llvm-project/commit/43a969debdd86ea96ea4998caa5c9b6b4c59dd7c
DIFF: https://github.com/llvm/llvm-project/commit/43a969debdd86ea96ea4998caa5c9b6b4c59dd7c.diff
LOG: [X86] combineADC - pull out repeated dyn_cast<ConstantSDNode> calls. NFC.
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index fe9cbdb836962..e232bd3a25cf0 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -52261,16 +52261,18 @@ static SDValue combineADC(SDNode *N, SelectionDAG &DAG,
SDValue LHS = N->getOperand(0);
SDValue RHS = N->getOperand(1);
SDValue CarryIn = N->getOperand(2);
+ auto *LHSC = dyn_cast<ConstantSDNode>(LHS);
+ auto *RHSC = dyn_cast<ConstantSDNode>(RHS);
// Canonicalize constant to RHS.
- if (isa<ConstantSDNode>(LHS) && !isa<ConstantSDNode>(RHS))
+ if (LHSC && !RHSC)
return DAG.getNode(X86ISD::ADC, SDLoc(N), N->getVTList(), RHS, LHS,
CarryIn);
// If the LHS and RHS of the ADC node are zero, then it can't overflow and
// the result is either zero or one (depending on the input carry bit).
// Strength reduce this down to a "set on carry" aka SETCC_CARRY&1.
- if (X86::isZeroNode(LHS) && X86::isZeroNode(RHS) &&
+ if (LHSC && RHSC && LHSC->isZero() && RHSC->isZero() &&
// We don't have a good way to replace an EFLAGS use, so only do this when
// dead right now.
SDValue(N, 1).use_empty()) {
@@ -52293,7 +52295,7 @@ static SDValue combineADC(SDNode *N, SelectionDAG &DAG,
// Fold ADC(ADD(X,Y),0,Carry) -> ADC(X,Y,Carry)
// iff the flag result is dead.
- if (LHS.getOpcode() == ISD::ADD && isNullConstant(RHS) &&
+ if (LHS.getOpcode() == ISD::ADD && RHSC && RHSC->isZero() &&
!N->hasAnyUseOfValue(1))
return DAG.getNode(X86ISD::ADC, SDLoc(N), N->getVTList(), LHS.getOperand(0),
LHS.getOperand(1), CarryIn);
More information about the llvm-commits
mailing list