[all-commits] [llvm/llvm-project] d80fdc: [DebugMetadata][DwarfDebug] Fix DWARF emisson of f...

Vladislav Dzhidzhoev via All-commits all-commits at lists.llvm.org
Thu Jun 15 08:18:47 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d80fdc6fc1a6e717af1bcd7a7313e65de433ba85
      https://github.com/llvm/llvm-project/commit/d80fdc6fc1a6e717af1bcd7a7313e65de433ba85
  Author: Vladislav Dzhidzhoev <vdzhidzhoev at accesssoftek.com>
  Date:   2023-06-15 (Thu, 15 Jun 2023)

  Changed paths:
    M clang/test/CodeGenCXX/debug-info-namespace.cpp
    M llvm/include/llvm/IR/DIBuilder.h
    M llvm/lib/Bitcode/Reader/MetadataLoader.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
    M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
    M llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
    M llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
    M llvm/lib/IR/DIBuilder.cpp
    M llvm/lib/IR/Verifier.cpp
    M llvm/lib/Linker/IRMover.cpp
    M llvm/test/Bitcode/DIImportedEntity_backward.ll
    M llvm/test/Bitcode/DIModule-fortran-external-module.ll
    A llvm/test/Bitcode/upgrade-cu-locals.ll
    A llvm/test/Bitcode/upgrade-cu-locals.ll.bc
    M llvm/test/CodeGen/Generic/DbgValueAggregate.ll
    A llvm/test/DebugInfo/Generic/import-inlined-declaration.ll
    M llvm/test/DebugInfo/Generic/imported-name-inlined.ll
    M llvm/test/DebugInfo/Generic/namespace.ll
    A llvm/test/DebugInfo/Generic/split-dwarf-local-import.ll
    A llvm/test/DebugInfo/Generic/split-dwarf-local-import2.ll
    A llvm/test/DebugInfo/Generic/split-dwarf-local-import3.ll
    M llvm/test/DebugInfo/Generic/verifier-invalid-disubprogram.ll
    M llvm/test/DebugInfo/X86/dimodule-external-fortran.ll
    M llvm/test/DebugInfo/X86/dwarfdump-DIImportedEntity_elements.ll
    M llvm/test/DebugInfo/X86/fission-inline.ll
    M llvm/test/DebugInfo/X86/fission-local-import.ll
    M llvm/test/DebugInfo/X86/fission-no-inline-gsym.ll
    M llvm/test/DebugInfo/X86/lexical-block-file-inline.ll
    M llvm/test/DebugInfo/X86/namelist2.ll
    M llvm/test/DebugInfo/omit-empty.ll
    M llvm/test/Linker/pr26037.ll
    M llvm/test/ThinLTO/X86/debuginfo-cu-import.ll

  Log Message:
  -----------
  [DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)

RFC https://discourse.llvm.org/t/rfc-dwarfdebug-fix-and-improve-handling-imported-entities-types-and-static-local-in-subprogram-and-lexical-block-scopes/68544

Fixed PR51501 (tests from D112337).

1. Reuse of DISubprogram's 'retainedNodes' to track other function-local
   entities together with local variables and labels (this patch cares about
   function-local import while D144006 and D144008 use the same approach for
   local types and static variables). So, effectively this patch moves ownership
   of tracking local import from DICompileUnit's 'imports' field to DISubprogram's
   'retainedNodes' and adjusts DWARF emitter for the new layout. The old layout
   is considered unsupported (DwarfDebug would assert on such debug metadata).

   DICompileUnit's 'imports' field is supposed to track global imported
   declarations as it does before.

   This addresses various FIXMEs and simplifies the next part of the patch.

2. Postpone emission of function-local imported entities from
   `DwarfDebug::endFunctionImpl()` to `DwarfDebug::endModule()`.
   While in `DwarfDebug::endFunctionImpl()` we do not have all the
   information about a parent subprogram or a referring subprogram
   (whether a subprogram inlined or not), so we can't guarantee we emit
   an imported entity correctly and place it in a proper subprogram tree.
   So now, we just gather needed details about the import itself and its
   parent entity (either a Subprogram or a LexicalBlock) during
   processing in `DwarfDebug::endFunctionImpl()`, but all the real work is
   done in `DwarfDebug::endModule()` when we have all the required
   information to make proper emission.

Authored-by: Kristina Bessonova <kbessonova at accesssoftek.com>

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




More information about the All-commits mailing list