[DebugInfo] Emit DW_AT_inline under -g1/-gmlt
authorZequan Wu <zequanwu@google.com>
Thu, 9 Sep 2021 23:00:15 +0000 (16:00 -0700)
committerZequan Wu <zequanwu@google.com>
Fri, 10 Sep 2021 01:59:50 +0000 (18:59 -0700)
Differential Revision: https://reviews.llvm.org/D109554

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

index 79c56a5..f82e9f4 100644 (file)
@@ -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);
 }
index 7e87a27..6879744 100644 (file)
 
 ; 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
index fbfd20f..35d2b27 100644 (file)
@@ -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