[llvm-branch-commits] [llvm-branch] r86214 - in /llvm/branches/Apple/Leela: lib/CodeGen/AsmPrinter/DwarfDebug.cpp test/DebugInfo/2009-11-05-DeadGlobalVariable.ll

Devang Patel dpatel at apple.com
Thu Nov 5 17:46:22 PST 2009


Author: dpatel
Date: Thu Nov  5 19:46:22 2009
New Revision: 86214

URL: http://llvm.org/viewvc/llvm-project?rev=86214&view=rev
Log:
Merge r86212 from trunk.

Added:
    llvm/branches/Apple/Leela/test/DebugInfo/2009-11-05-DeadGlobalVariable.ll
      - copied unchanged from r86212, llvm/trunk/test/DebugInfo/2009-11-05-DeadGlobalVariable.ll
Modified:
    llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=86214&r1=86213&r2=86214&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Nov  5 19:46:22 2009
@@ -1097,6 +1097,10 @@
 /// CreateGlobalVariableDIE - Create new DIE using GV.
 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;
+
   DIE *GVDie = new DIE(dwarf::DW_TAG_variable);
   AddString(GVDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, 
             GV.getDisplayName());
@@ -1511,7 +1515,8 @@
     DIGlobalVariable GV(N);
     if (GV.getContext().getNode() == RootScope->getDesc().getNode()) {
       DIE *ScopedGVDie = CreateGlobalVariableDIE(ModuleCU, GV);
-      SPDie->AddChild(ScopedGVDie);
+      if (ScopedGVDie)
+        SPDie->AddChild(ScopedGVDie);
     }
   }
 }





More information about the llvm-branch-commits mailing list