[llvm] 010b09b - [DAG] reassociateOpsCommutative - test getNode result directly. NFC

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 11 10:47:08 PST 2021


Author: Simon Pilgrim
Date: 2021-11-11T18:45:50Z
New Revision: 010b09b0c5d0ecf211b4675ec7f66767fdc24c87

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

LOG: [DAG] reassociateOpsCommutative - test getNode result directly. NFC

Matches the clean code style we use directly above

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 0c7db2966724..a47496740ffa 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -1076,10 +1076,9 @@ SDValue DAGCombiner::reassociateOpsCommutative(unsigned Opc, const SDLoc &DL,
     if (N0.hasOneUse()) {
       // Reassociate: (op (op x, c1), y) -> (op (op x, y), c1)
       //              iff (op x, c1) has one use
-      SDValue OpNode = DAG.getNode(Opc, SDLoc(N0), VT, N00, N1);
-      if (!OpNode.getNode())
-        return SDValue();
-      return DAG.getNode(Opc, DL, VT, OpNode, N01);
+      if (SDValue OpNode = DAG.getNode(Opc, SDLoc(N0), VT, N00, N1))
+        return DAG.getNode(Opc, DL, VT, OpNode, N01);
+      return SDValue();
     }
   }
   return SDValue();


        


More information about the llvm-commits mailing list