[llvm] 35be4a7 - [SelectionDAG] Remove unecessary null check after call to getNode. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 11 18:08:05 PDT 2022


Author: Craig Topper
Date: 2022-04-11T18:03:44-07:00
New Revision: 35be4a7af3b20447d52093ebb6f7d2420ac11270

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

LOG: [SelectionDAG] Remove unecessary null check after call to getNode. NFC

As far as I know getNode will never return a null SDValue.

I'm guessing this was modeled after the FoldConstantArithmetic
call earlier.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D123550

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


        


More information about the llvm-commits mailing list