aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-12-01 23:07:59 +0000
committerDevang Patel <dpatel@apple.com>2009-12-01 23:07:59 +0000
commit7d0750a10fac5c00f00b465d8633d00fe76d9a2c (patch)
tree44e84648eccfd9a8cca8426708c71d345262232b
parent6e1f16d5221a0bb3fe5292b3cf84d225c00f95f6 (diff)
Reuse existing subprogram DIE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90281 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 30264c751b..dcb5900fe9 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1087,7 +1087,11 @@ DIE *DwarfDebug::createSubprogramDIE(CompileUnit *DW_Unit,
const DISubprogram &SP,
bool IsConstructor,
bool IsInlined) {
- DIE *SPDie = new DIE(dwarf::DW_TAG_subprogram);
+ DIE *SPDie = ModuleCU->getDIE(SP.getNode());
+ if (SPDie)
+ return SPDie;
+
+ SPDie = new DIE(dwarf::DW_TAG_subprogram);
addString(SPDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, SP.getName());
StringRef LinkageName = SP.getLinkageName();
@@ -1669,7 +1673,8 @@ void DwarfDebug::constructSubprogramDIE(MDNode *N) {
ModuleCU->insertDIE(N, SubprogramDie);
// Add to context owner.
- ModuleCU->getCUDie()->addChild(SubprogramDie);
+ if (SP.getContext().getNode() == SP.getCompileUnit().getNode())
+ ModuleCU->getCUDie()->addChild(SubprogramDie);
// Expose as global.
ModuleCU->addGlobal(SP.getName(), SubprogramDie);