[llvm] r208798 - DebugInfo: Do not delay attaching DW_AT_inline attribute to abstract definitions.

David Blaikie dblaikie at gmail.com
Wed May 14 10:58:53 PDT 2014


Author: dblaikie
Date: Wed May 14 12:58:53 2014
New Revision: 208798

URL: http://llvm.org/viewvc/llvm-project?rev=208798&view=rev
Log:
DebugInfo: Do not delay attaching DW_AT_inline attribute to abstract definitions.

This is just unneccessary - we only create abstract definitions when
we're inlining anyway, so there's no reason to delay this to see if
we're going to inline anything.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=208798&r1=208797&r2=208798&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed May 14 12:58:53 2014
@@ -463,11 +463,13 @@ DwarfDebug::constructInlinedScopeDIE(Dwa
   assert(!ScopeRanges.empty() &&
          "LexicalScope does not have instruction markers!");
 
-  if (!Scope->getScopeNode())
-    return nullptr;
+  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;
@@ -582,6 +584,7 @@ void DwarfDebug::constructAbstractSubpro
 
   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);
   }
 }
@@ -856,16 +859,6 @@ void DwarfDebug::beginModule() {
   SectionMap[Asm->getObjFileLowering().getTextSection()];
 }
 
-// Attach DW_AT_inline attribute with inlined subprogram DIEs.
-void DwarfDebug::computeInlinedDIEs() {
-  for (const auto &AI : AbstractSPDies) {
-    DIE &ISP = *AI.second;
-    if (InlinedSubprogramDIEs.count(&ISP))
-      continue;
-    FirstCU->addUInt(ISP, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined);
-  }
-}
-
 // Collect info for variables that were optimized out.
 void DwarfDebug::collectDeadVariables() {
   const Module *M = MMI->getModule();
@@ -910,9 +903,6 @@ void DwarfDebug::finalizeModuleInfo() {
   // Collect info for variables that were optimized out.
   collectDeadVariables();
 
-  // Attach DW_AT_inline attribute with inlined subprogram DIEs.
-  computeInlinedDIEs();
-
   // Handle anything that needs to be done on a per-unit basis after
   // all other generation.
   for (const auto &TheU : getUnits()) {

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=208798&r1=208797&r2=208798&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed May 14 12:58:53 2014
@@ -385,9 +385,6 @@ class DwarfDebug : public AsmPrinterHand
   /// \brief Compute the size and offset of all the DIEs.
   void computeSizeAndOffsets();
 
-  /// \brief Attach DW_AT_inline attribute with inlined subprogram DIEs.
-  void computeInlinedDIEs();
-
   /// \brief Collect info for variables that were optimized out.
   void collectDeadVariables();
 





More information about the llvm-commits mailing list