[llvm-commits] [llvm] r56399 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp

Chris Lattner sabre at nondot.org
Sun Sep 21 11:38:32 PDT 2008


Author: lattner
Date: Sun Sep 21 13:38:31 2008
New Revision: 56399

URL: http://llvm.org/viewvc/llvm-project?rev=56399&view=rev
Log:
don't print GlobalAddressSDNode's with an offset of zero as "foo0".

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

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=56399&r1=56398&r2=56399&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Sun Sep 21 13:38:31 2008
@@ -126,12 +126,13 @@
     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)) {





More information about the llvm-commits mailing list