don't print GlobalAddressSDNode's with an offset of zero as "foo0".
authorChris Lattner <sabre@nondot.org>
Sun, 21 Sep 2008 18:38:31 +0000 (18:38 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 21 Sep 2008 18:38:31 +0000 (18:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56399 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp

index caeaa838e9a8961341bb6aafc7fc1e0c68b775eb..410f6157358a45c0a47b2c378cd912f4b5ba0041 100644 (file)
@@ -126,12 +126,13 @@ std::string DOTGraphTraits<SelectionDAG*>::getNodeLabel(const SDNode *Node,
     Op += ": " + ftostr(CSDN->getValueAPF());
   } else if (const GlobalAddressSDNode *GADN =
              dyn_cast<GlobalAddressSDNode>(Node)) {
-    int offset = GADN->getOffset();
     Op += ": " + GADN->getGlobal()->getName();
-    if (offset > 0)
-      Op += "+" + itostr(offset);
-    else
-      Op += itostr(offset);
+    if (int Offset = GADN->getOffset()) {
+      if (Offset > 0)
+        Op += "+" + itostr(Offset);
+      else
+        Op += itostr(Offset);
+    }
   } else if (const FrameIndexSDNode *FIDN = dyn_cast<FrameIndexSDNode>(Node)) {
     Op += " " + itostr(FIDN->getIndex());
   } else if (const JumpTableSDNode *JTDN = dyn_cast<JumpTableSDNode>(Node)) {