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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 11 15:39:58 PDT 2022


craig.topper created this revision.
craig.topper added reviewers: spatel, RKSimon, arsenm, efriedma.
Herald added subscribers: StephenFan, ecnelises, hiraditya.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

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

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123550

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -1070,9 +1070,8 @@
     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);
     }
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123550.422059.patch
Type: text/x-patch
Size: 689 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220411/d14d1c11/attachment.bin>


More information about the llvm-commits mailing list