[PATCH] D109554: [DebugInfo] Emit DW_AT_inline under -g1/-gmlt

Zequan Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 9 16:00:50 PDT 2021


zequanwu created this revision.
Herald added a subscriber: hiraditya.
zequanwu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109554

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


Index: llvm/test/DebugInfo/X86/fission-inline.ll
===================================================================
--- llvm/test/DebugInfo/X86/fission-inline.ll
+++ 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
Index: llvm/test/DebugInfo/Inputs/gmlt.ll
===================================================================
--- llvm/test/DebugInfo/Inputs/gmlt.ll
+++ 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
Index: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -1105,9 +1105,12 @@
   // 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);
+  if (DD->getDwarfVersion() <= 4)
+    ContextCU->addUInt(*AbsDef, dwarf::DW_AT_inline, None,
+                       dwarf::DW_INL_inlined);
+  else
+    ContextCU->addSInt(*AbsDef, dwarf::DW_AT_inline,
+                       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);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109554.371741.patch
Type: text/x-patch
Size: 2170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210909/00aac93e/attachment.bin>


More information about the llvm-commits mailing list