summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
index caeaa838e9..410f615735 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
@@ -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)) {