[llvm] r210946 - DebugInfo: Reference abstract definitions from variables in concrete definitions that preceed their first inline definition.

David Blaikie dblaikie at gmail.com
Fri Jun 13 15:35:45 PDT 2014


Author: dblaikie
Date: Fri Jun 13 17:35:44 2014
New Revision: 210946

URL: http://llvm.org/viewvc/llvm-project?rev=210946&view=rev
Log:
DebugInfo: Reference abstract definitions from variables in concrete definitions that preceed their first inline definition.

Rather than relying on abstract variables looked up at the time the
concrete variable is created, look them up at the end of the module to
ensure they're referenced even if they're created after the concrete
definition. This completes/matches the work done in r209677 to handle
this for the subprograms themselves.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
    llvm/trunk/test/DebugInfo/X86/dbg-value-inlined-parameter.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=210946&r1=210945&r2=210946&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jun 13 17:35:44 2014
@@ -791,7 +791,7 @@ void DwarfDebug::finishVariableDefinitio
     // DIE::getUnit isn't simple - it walks parent pointers, etc.
     DwarfCompileUnit *Unit = lookupUnit(VariableDie->getUnit());
     assert(Unit);
-    DbgVariable *AbsVar = Var->getAbstractVariable();
+    DbgVariable *AbsVar = getExistingAbstractVariable(Var->getVariable());
     if (AbsVar && AbsVar->getDIE()) {
       Unit->addDIEEntry(*VariableDie, dwarf::DW_AT_abstract_origin,
                         *AbsVar->getDIE());
@@ -1081,6 +1081,11 @@ DbgVariable *DwarfDebug::getExistingAbst
   return nullptr;
 }
 
+DbgVariable *DwarfDebug::getExistingAbstractVariable(const DIVariable &DV) {
+  DIVariable Cleansed;
+  return getExistingAbstractVariable(DV, Cleansed);
+}
+
 DbgVariable *DwarfDebug::createAbstractVariable(DIVariable &Var,
                                                 LexicalScope *Scope) {
   auto AbsDbgVariable = make_unique<DbgVariable>(Var, nullptr, this);

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=210946&r1=210945&r2=210946&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Fri Jun 13 17:35:44 2014
@@ -346,6 +346,7 @@ class DwarfDebug : public AsmPrinterHand
   /// \brief Find abstract variable associated with Var.
   DbgVariable *getExistingAbstractVariable(const DIVariable &DV,
                                            DIVariable &Cleansed);
+  DbgVariable *getExistingAbstractVariable(const DIVariable &DV);
   DbgVariable *createAbstractVariable(DIVariable &DV, LexicalScope *Scope);
   DbgVariable *getOrCreateAbstractVariable(DIVariable &Var,
                                            const MDNode *Scope);

Modified: llvm/trunk/test/DebugInfo/X86/dbg-value-inlined-parameter.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-value-inlined-parameter.ll?rev=210946&r1=210945&r2=210946&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dbg-value-inlined-parameter.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/dbg-value-inlined-parameter.ll Fri Jun 13 17:35:44 2014
@@ -7,22 +7,20 @@
 
 ; CHECK: DW_TAG_subprogram
 ; CHECK:   DW_AT_abstract_origin {{.*}}{[[ABS:.*]]}
-; FIXME: An out of line definition preceding an inline usage doesn't properly
-; reference abstract variables.
 ; CHECK:   DW_TAG_formal_parameter
 ; CHECK-NOT: DW_TAG
-; CHECK:     DW_AT_name {{.*}} "sp"
+; CHECK:     DW_AT_abstract_origin {{.*}}{[[ABS_SP:.*]]}
 ; CHECK:   DW_TAG_formal_parameter
 ; CHECK-NOT: DW_TAG
-; CHECK:     DW_AT_name {{.*}} "nums"
+; CHECK:     DW_AT_abstract_origin {{.*}}{[[ABS_NUMS:.*]]}
 
 ; CHECK: [[ABS]]: DW_TAG_subprogram
 ; CHECK-NOT: DW_TAG
 ; CHECK:   DW_AT_name {{.*}} "foo"
-; CHECK: [[ABS_SP:.*]]:   DW_TAG_formal_parameter
+; CHECK: [[ABS_SP]]:   DW_TAG_formal_parameter
 ; CHECK-NOT: DW_TAG
 ; CHECK:     DW_AT_name {{.*}} "sp"
-; CHECK: [[ABS_NUMS:.*]]:  DW_TAG_formal_parameter
+; CHECK: [[ABS_NUMS]]:  DW_TAG_formal_parameter
 ; CHECK-NOT: DW_TAG
 ; CHECK:     DW_AT_name {{.*}} "nums"
 





More information about the llvm-commits mailing list