Debug Info: Don't print the display name and colon prefix for DEBUG_VALUE comments...
authorDavid Blaikie <dblaikie@gmail.com>
Sat, 15 Jun 2013 00:33:47 +0000 (00:33 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Sat, 15 Jun 2013 00:33:47 +0000 (00:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184026 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/AsmPrinter.cpp
test/CodeGen/X86/dbg-value-terminator.ll

index 69ff329057382daf9d99fcdecc8098ec497f093b..7f4ba7a0d939956cc97e360895ad17ed74656618 100644 (file)
@@ -562,8 +562,11 @@ static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
 
   // cast away const; DIetc do not take const operands for some reason.
   DIVariable V(const_cast<MDNode*>(MI->getOperand(2).getMetadata()));
-  if (V.getContext().isSubprogram())
-    OS << DISubprogram(V.getContext()).getDisplayName() << ":";
+  if (V.getContext().isSubprogram()) {
+    StringRef Name = DISubprogram(V.getContext()).getDisplayName();
+    if (!Name.empty())
+      OS << Name << ":";
+  }
   OS << V.getName() << " <- ";
 
   // Register or immediate value. Register 0 means undef.
index ed0b2129a7b7b44c47919522156ef6ba348c45a5..e7c12507d80e06aed714bb9765edde3391c08fb6 100644 (file)
@@ -6,7 +6,7 @@
 ; terminator.
 ;
 ; CHECK: test:
-; CHECK: ##DEBUG_VALUE: :i
+; CHECK: ##DEBUG_VALUE: i
 %a = type { i32, i32 }
 
 define hidden fastcc %a* @test() #1 {