[llvm] 12f80c0 - [DebugInfo] Emit DW_AT_inline under -g1/-gmlt

Zequan Wu via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 9 19:00:01 PDT 2021


Author: Zequan Wu
Date: 2021-09-09T18:59:50-07:00
New Revision: 12f80c0bbda2b1492f521345b287343457ccd03c

URL: https://github.com/llvm/llvm-project/commit/12f80c0bbda2b1492f521345b287343457ccd03c
DIFF: https://github.com/llvm/llvm-project/commit/12f80c0bbda2b1492f521345b287343457ccd03c.diff

LOG: [DebugInfo] Emit DW_AT_inline under -g1/-gmlt

Differential Revision: https://reviews.llvm.org/D109554

Added: 
    

Modified: 
    llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    llvm/test/DebugInfo/Inputs/gmlt.ll
    llvm/test/DebugInfo/X86/fission-inline.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 79c56a51abe4e..f82e9f4050de6 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -1105,9 +1105,10 @@ void DwarfCompileUnit::constructAbstractSubprogramScopeDIE(
   // shouldn't be found by lookup.
   AbsDef = &ContextCU->createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, nullptr);
   ContextCU->applySubprogramAttributesToDefinition(SP, *AbsDef);
-
-  if (!ContextCU->includeMinimalInlineScopes())
-    ContextCU->addUInt(*AbsDef, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined);
+  ContextCU->addSInt(*AbsDef, dwarf::DW_AT_inline,
+                     DD->getDwarfVersion() <= 4 ? Optional<dwarf::Form>()
+                                                : dwarf::DW_FORM_implicit_const,
+                     dwarf::DW_INL_inlined);
   if (DIE *ObjectPointer = ContextCU->createAndAddScopeChildren(Scope, *AbsDef))
     ContextCU->addDIEEntry(*AbsDef, dwarf::DW_AT_object_pointer, *ObjectPointer);
 }

diff  --git a/llvm/test/DebugInfo/Inputs/gmlt.ll b/llvm/test/DebugInfo/Inputs/gmlt.ll
index 7e87a2798bdb6..68797441dee6c 100644
--- a/llvm/test/DebugInfo/Inputs/gmlt.ll
+++ b/llvm/test/DebugInfo/Inputs/gmlt.ll
@@ -42,12 +42,7 @@
 
 ; CHECK: DW_TAG_subprogram
 ; CHECK-NEXT:     DW_AT_name {{.*}} "f3"
-
-; FIXME: We don't really need DW_AT_inline, consumers can ignore this due to
-; the absence of high_pc/low_pc/ranges and know that they just need it for
-; retrieving the name of a concrete inlined instance
-
-; CHECK-NOT: {{DW_TAG|DW_AT|NULL}}
+; CHECK-NEXT:     DW_AT_inline
 
 ; Check that we only provide the minimal attributes on a subprogram to save space.
 ; CHECK:   DW_TAG_subprogram

diff  --git a/llvm/test/DebugInfo/X86/fission-inline.ll b/llvm/test/DebugInfo/X86/fission-inline.ll
index fbfd20fc83de9..35d2b2794a015 100644
--- a/llvm/test/DebugInfo/X86/fission-inline.ll
+++ b/llvm/test/DebugInfo/X86/fission-inline.ll
@@ -58,7 +58,7 @@
 
 ; CHECK:      DW_TAG_subprogram
 ; CHECK-NEXT:   DW_AT_name {{.*}} "f2<int>"
-; CHECK-NOT: DW_
+; CHECK-NEXT:   DW_AT_inline
 ; CHECK:      DW_TAG_subprogram
 ; CHECK-NEXT:   DW_AT_low_pc [DW_FORM_addr]
 ; CHECK-NEXT:   DW_AT_high_pc


        


More information about the llvm-commits mailing list