[PATCH] D107884: [DAG] Use 'continue' to simplify EnforceNodeIdInvariant. NFC.

Madhur Amilkanthwar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 11 00:19:58 PDT 2021


madhur13490 created this revision.
madhur13490 added reviewers: niravd, craig.topper.
Herald added a subscriber: hiraditya.
madhur13490 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Reduce nesting of the loop and make the function more readble.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107884

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


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -1072,10 +1072,10 @@
     SDNode *N = Nodes.pop_back_val();
     for (auto *U : N->uses()) {
       auto UId = U->getNodeId();
-      if (UId > 0) {
-        InvalidateNodeId(U);
-        Nodes.push_back(U);
-      }
+      if (UId <= 0)
+        continue;
+      InvalidateNodeId(U);
+      Nodes.push_back(U);
     }
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107884.365681.patch
Type: text/x-patch
Size: 566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210811/b860f659/attachment.bin>


More information about the llvm-commits mailing list