diff options
author | Devang Patel <dpatel@apple.com> | 2009-11-06 01:30:04 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-11-06 01:30:04 +0000 |
commit | 06ce6506d2db3c42a8609d4746052fddca7e829b (patch) | |
tree | 16507731b3893108d9fbd6df17c3b84b38c201dd /llvm/lib | |
parent | ad8b22269efc89858f1ef2bf0ba35e9a12f1d26d (diff) | |
download | bcm5719-llvm-06ce6506d2db3c42a8609d4746052fddca7e829b.tar.gz bcm5719-llvm-06ce6506d2db3c42a8609d4746052fddca7e829b.zip |
Do not try to emit debug info entry for dead global variable.
llvm-svn: 86212
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 1372fc21685..6b54e618c3d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1097,6 +1097,10 @@ DIE *DwarfDebug::ConstructEnumTypeDIE(CompileUnit *DW_Unit, DIEnumerator *ETy) { /// 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()); @@ -1518,7 +1522,8 @@ void DwarfDebug::ConstructFunctionDbgScope(DbgScope *RootScope, DIGlobalVariable GV(N); if (GV.getContext().getNode() == RootScope->getDesc().getNode()) { DIE *ScopedGVDie = CreateGlobalVariableDIE(ModuleCU, GV); - SPDie->AddChild(ScopedGVDie); + if (ScopedGVDie) + SPDie->AddChild(ScopedGVDie); } } } |