[llvm-commits] [llvm] r86259 - in /llvm/trunk: lib/Analysis/DebugInfo.cpp lib/CodeGen/AsmPrinter/DwarfDebug.cpp test/DebugInfo/2009-11-06-NamelessGlobalVariable.ll

Devang Patel dpatel at apple.com
Fri Nov 6 09:58:12 PST 2009


Author: dpatel
Date: Fri Nov  6 11:58:12 2009
New Revision: 86259

URL: http://llvm.org/viewvc/llvm-project?rev=86259&view=rev
Log:
Do not bother to emit debug info for nameless global variable.

Added:
    llvm/trunk/test/DebugInfo/2009-11-06-NamelessGlobalVariable.ll
Modified:
    llvm/trunk/lib/Analysis/DebugInfo.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=86259&r1=86258&r2=86259&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/DebugInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/DebugInfo.cpp Fri Nov  6 11:58:12 2009
@@ -366,6 +366,9 @@
   if (isNull())
     return false;
 
+  if (!getDisplayName())
+    return false;
+
   if (getContext().isNull())
     return false;
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=86259&r1=86258&r2=86259&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Nov  6 11:58:12 2009
@@ -1098,8 +1098,8 @@
 DIE *DwarfDebug::CreateGlobalVariableDIE(CompileUnit *DW_Unit,
                                          const DIGlobalVariable &GV) {
   // If the global variable was optmized out then no need to create debug info entry.
-  if (!GV.getGlobal())
-    return NULL;
+  if (!GV.getGlobal()) return NULL;
+  if (!GV.getDisplayName()) return NULL;
 
   DIE *GVDie = new DIE(dwarf::DW_TAG_variable);
   AddString(GVDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, 

Added: llvm/trunk/test/DebugInfo/2009-11-06-NamelessGlobalVariable.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2009-11-06-NamelessGlobalVariable.ll?rev=86259&view=auto

==============================================================================
--- llvm/trunk/test/DebugInfo/2009-11-06-NamelessGlobalVariable.ll (added)
+++ llvm/trunk/test/DebugInfo/2009-11-06-NamelessGlobalVariable.ll Fri Nov  6 11:58:12 2009
@@ -0,0 +1,8 @@
+; RUN: llc %s -o /dev/null
+ at 0 = internal constant i32 1                      ; <i32*> [#uses=1]
+
+!llvm.dbg.gv = !{!0}
+
+!0 = metadata !{i32 458804, i32 0, metadata !1, metadata !"", metadata !"", metadata !"", metadata !1, i32 378, metadata !2, i1 true, i1 true, i32* @0}; [DW_TAG_variable ]
+!1 = metadata !{i32 458769, i32 0, i32 1, metadata !"cbdsqr.f", metadata !"/home/duncan/LLVM/dragonegg/unsolved/", metadata !"4.5.0 20091030 (experimental)", i1 true, i1 false, metadata !"", i32 0}; [DW_TAG_compile_unit ]
+!2 = metadata !{i32 458788, metadata !1, metadata !"integer(kind=4)", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5}; [DW_TAG_base_type ]





More information about the llvm-commits mailing list