[llvm] e41d383 - [ARM] Use isNullConstant (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 27 00:18:32 PDT 2023


Author: Kazu Hirata
Date: 2023-08-27T00:18:19-07:00
New Revision: e41d383440883fa2f87012b765fcc2d450f6fd55

URL: https://github.com/llvm/llvm-project/commit/e41d383440883fa2f87012b765fcc2d450f6fd55
DIFF: https://github.com/llvm/llvm-project/commit/e41d383440883fa2f87012b765fcc2d450f6fd55.diff

LOG: [ARM] Use isNullConstant (NFC)

Added: 
    

Modified: 
    llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp b/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
index a0607cb5662efb..7d44c5b44fd962 100644
--- a/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
+++ b/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
@@ -1130,8 +1130,7 @@ static bool shouldUseZeroOffsetLdSt(SDValue N) {
 bool ARMDAGToDAGISel::SelectThumbAddrModeRRSext(SDValue N, SDValue &Base,
                                                 SDValue &Offset) {
   if (N.getOpcode() != ISD::ADD && !CurDAG->isBaseWithConstantOffset(N)) {
-    ConstantSDNode *NC = dyn_cast<ConstantSDNode>(N);
-    if (!NC || !NC->isZero())
+    if (!isNullConstant(N))
       return false;
 
     Base = Offset = N;
@@ -3559,8 +3558,7 @@ void ARMDAGToDAGISel::SelectCMPZ(SDNode *N, bool &SwitchEQNEToPLMI) {
     return;
 
   SDValue Zero = N->getOperand(1);
-  if (!isa<ConstantSDNode>(Zero) || !cast<ConstantSDNode>(Zero)->isZero() ||
-      And->getOpcode() != ISD::AND)
+  if (!isNullConstant(Zero) || And->getOpcode() != ISD::AND)
     return;
   SDValue X = And.getOperand(0);
   auto C = dyn_cast<ConstantSDNode>(And.getOperand(1));


        


More information about the llvm-commits mailing list