[llvm] 69f3319 - [PowerPC] Use isNullConstant (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 21 08:19:34 PDT 2023


Author: Kazu Hirata
Date: 2023-08-21T08:19:28-07:00
New Revision: 69f3319cbeb5e6a0c426c19533001d2c53158d80

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

LOG: [PowerPC] Use isNullConstant (NFC)

Added: 
    

Modified: 
    llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
index 96fd83ab6a7bc8..98936fe4011d40 100644
--- a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
@@ -4835,8 +4835,7 @@ bool PPCDAGToDAGISel::tryFoldSWTestBRCC(SDNode *N) {
     return false;
 
   SDValue CmpRHS = N->getOperand(3);
-  if (!isa<ConstantSDNode>(CmpRHS) ||
-      cast<ConstantSDNode>(CmpRHS)->getSExtValue() != 0)
+  if (!isNullConstant(CmpRHS))
     return false;
 
   SDValue CmpLHS = N->getOperand(2);
@@ -6659,11 +6658,7 @@ bool PPCDAGToDAGISel::AllUsersSelectZero(SDNode *N) {
         Op2->getMachineOpcode() != PPC::LI8)
       return false;
 
-    ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op2->getOperand(0));
-    if (!C)
-      return false;
-
-    if (!C->isZero())
+    if (!isNullConstant(Op2->getOperand(0)))
       return false;
   }
 


        


More information about the llvm-commits mailing list