summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-05-21 23:14:12 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-05-21 23:14:12 +0000
commit1ea9db2dce3ef5d5e627b5ed3f7c6d95c16a0c37 (patch)
tree03c9eb73469e32e5484e1c3a35f0aa986144283a /llvm/lib
parent8f2394d456c49d9d9b36e0ecf041ea2b193dde9f (diff)
downloadbcm5719-llvm-1ea9db2dce3ef5d5e627b5ed3f7c6d95c16a0c37.tar.gz
bcm5719-llvm-1ea9db2dce3ef5d5e627b5ed3f7c6d95c16a0c37.zip
DebugInfo: Use the SPMap to find the parent CU of inlined functions as they may not be in the current CU
Committed in r209178 then reverted in r209251 due to LTO breakage, here's a proper fix for the case of the missing subprogram DIE. The DIEs were there, just in other compile units. Using the SPMap we can find the right compile unit to search for and produce cross-unit references to describe this kind of inlining. One existing test case needed to be updated because it had a function that wasn't in the CU's subprogram list, so it didn't appear in the SPMap. llvm-svn: 209335
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index e4170f026bd..745b2f04327 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -431,14 +431,10 @@ DwarfDebug::constructInlinedScopeDIE(DwarfCompileUnit &TheCU,
assert(Scope->getScopeNode());
DIScope DS(Scope->getScopeNode());
DISubprogram InlinedSP = getDISubprogram(DS);
- DIE *OriginDIE = TheCU.getDIE(InlinedSP);
- // FIXME: This should be an assert (or possibly a
- // getOrCreateSubprogram(InlinedSP)) otherwise we're just failing to emit
- // inlining information.
- if (!OriginDIE) {
- DEBUG(dbgs() << "Unable to find original DIE for an inlined subprogram.");
- return nullptr;
- }
+ // Find the subprogram's DwarfCompileUnit in the SPMap in case the subprogram
+ // was inlined from another compile unit.
+ DIE *OriginDIE = SPMap[InlinedSP]->getDIE(InlinedSP);
+ assert(OriginDIE && "Unable to find original DIE for an inlined subprogram.");
auto ScopeDIE = make_unique<DIE>(dwarf::DW_TAG_inlined_subroutine);
TheCU.addDIEEntry(*ScopeDIE, dwarf::DW_AT_abstract_origin, *OriginDIE);
@@ -530,11 +526,13 @@ void DwarfDebug::constructAbstractSubprogramScopeDIE(DwarfCompileUnit &TheCU,
if (!ProcessedSPNodes.insert(Sub))
return;
- if (DIE *ScopeDIE = TheCU.getDIE(Sub)) {
- AbstractSPDies.insert(std::make_pair(Sub, ScopeDIE));
- TheCU.addUInt(*ScopeDIE, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined);
- createAndAddScopeChildren(TheCU, Scope, *ScopeDIE);
- }
+ // Find the subprogram's DwarfCompileUnit in the SPMap in case the subprogram
+ // was inlined from another compile unit.
+ DIE *ScopeDIE = SPMap[Sub]->getDIE(Sub);
+ assert(ScopeDIE);
+ AbstractSPDies.insert(std::make_pair(Sub, ScopeDIE));
+ TheCU.addUInt(*ScopeDIE, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined);
+ createAndAddScopeChildren(TheCU, Scope, *ScopeDIE);
}
DIE &DwarfDebug::constructSubprogramScopeDIE(DwarfCompileUnit &TheCU,
OpenPOWER on IntegriCloud