[llvm] r233577 - SelectionDAG: Reflow code to use early returns, NFC

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Mar 30 11:23:28 PDT 2015


Author: dexonsmith
Date: Mon Mar 30 13:23:28 2015
New Revision: 233577

URL: http://llvm.org/viewvc/llvm-project?rev=233577&view=rev
Log:
SelectionDAG: Reflow code to use early returns, NFC

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp?rev=233577&r1=233576&r2=233577&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp Mon Mar 30 13:23:28 2015
@@ -520,22 +520,26 @@ void SDNode::print_details(raw_ostream &
   if (getNodeId() != -1)
     OS << " [ID=" << getNodeId() << ']';
 
+  if (!G)
+    return;
+
   DebugLoc dl = getDebugLoc();
-  if (G && !dl.isUnknown()) {
-    DIScope
-      Scope(dl.getScope(G->getMachineFunction().getFunction()->getContext()));
-    OS << " dbg:";
-    assert((!Scope || Scope.isScope()) &&
-      "Scope of a DebugLoc should be null or a DIScope.");
-    // Omit the directory, since it's usually long and uninteresting.
-    if (Scope)
-      OS << Scope.getFilename();
-    else
-      OS << "<unknown>";
-    OS << ':' << dl.getLine();
-    if (dl.getCol() != 0)
-      OS << ':' << dl.getCol();
-  }
+  if (dl.isUnknown())
+    return;
+
+  DIScope Scope(
+      dl.getScope(G->getMachineFunction().getFunction()->getContext()));
+  OS << " dbg:";
+  assert((!Scope || Scope.isScope()) &&
+         "Scope of a DebugLoc should be null or a DIScope.");
+  // Omit the directory, since it's usually long and uninteresting.
+  if (Scope)
+    OS << Scope.getFilename();
+  else
+    OS << "<unknown>";
+  OS << ':' << dl.getLine();
+  if (unsigned C = dl.getCol())
+    OS << ':' << C;
 }
 
 static void DumpNodes(const SDNode *N, unsigned indent, const SelectionDAG *G) {





More information about the llvm-commits mailing list