[all-commits] [llvm/llvm-project] 0ac75e: Reland [DwarfDebug] Move emission of global vars, ...

chbessonova via All-commits all-commits at lists.llvm.org
Sun Dec 5 03:57:17 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0ac75e82fff93a80ca401d3db3541e8d1d9098f9
      https://github.com/llvm/llvm-project/commit/0ac75e82fff93a80ca401d3db3541e8d1d9098f9
  Author: Kristina Bessonova <kbessonova at accesssoftek.com>
  Date:   2021-12-05 (Sun, 05 Dec 2021)

  Changed paths:
    M lld/test/wasm/debuginfo.test
    M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    M llvm/test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll
    M llvm/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll
    M llvm/test/DebugInfo/AMDGPU/variable-locations.ll
    M llvm/test/DebugInfo/BPF/extern-void.ll
    M llvm/test/DebugInfo/Generic/cross-cu-linkonce-distinct.ll
    M llvm/test/DebugInfo/Generic/debug-info-qualifiers.ll
    M llvm/test/DebugInfo/Generic/debug-names-linkage-name.ll
    M llvm/test/DebugInfo/Generic/enum-types.ll
    M llvm/test/DebugInfo/Generic/incorrect-variable-debugloc.ll
    M llvm/test/DebugInfo/Generic/namespace.ll
    M llvm/test/DebugInfo/Generic/varargs.ll
    M llvm/test/DebugInfo/MIR/AArch64/implicit-def-dead-scope.mir
    M llvm/test/DebugInfo/NVPTX/debug-addr-class.ll
    M llvm/test/DebugInfo/NVPTX/debug-info.ll
    M llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll
    M llvm/test/DebugInfo/PowerPC/strict-dwarf.ll
    M llvm/test/DebugInfo/X86/2011-09-26-GlobalVarContext.ll
    M llvm/test/DebugInfo/X86/DW_AT_calling-convention.ll
    M llvm/test/DebugInfo/X86/align_cpp11.ll
    M llvm/test/DebugInfo/X86/align_objc.ll
    M llvm/test/DebugInfo/X86/arange-and-stub.ll
    M llvm/test/DebugInfo/X86/containing-type-extension-rust.ll
    M llvm/test/DebugInfo/X86/debug-info-access.ll
    M llvm/test/DebugInfo/X86/debug-info-blocks.ll
    M llvm/test/DebugInfo/X86/debug-info-static-member.ll
    M llvm/test/DebugInfo/X86/debug-loc-offset.mir
    M llvm/test/DebugInfo/X86/dwarf-aranges.ll
    M llvm/test/DebugInfo/X86/dwarf-linkage-names.ll
    M llvm/test/DebugInfo/X86/dwarfdump-DIImportedEntity_elements.ll
    M llvm/test/DebugInfo/X86/generate-odr-hash.ll
    M llvm/test/DebugInfo/X86/gnu-public-names.ll
    M llvm/test/DebugInfo/X86/lexical-block-file-inline.ll
    M llvm/test/DebugInfo/X86/linkage-name.ll
    M llvm/test/DebugInfo/X86/namelist1.ll
    M llvm/test/DebugInfo/X86/sret.ll
    M llvm/test/DebugInfo/X86/subprogram-across-cus.ll
    M llvm/test/DebugInfo/X86/template.ll
    M llvm/test/DebugInfo/X86/tls.ll
    M llvm/test/DebugInfo/X86/vla-global.ll
    M llvm/test/DebugInfo/attr-btf_tag.ll
    M llvm/test/MC/WebAssembly/debug-info.ll
    M llvm/test/MC/WebAssembly/debug-info64.ll
    M llvm/test/MC/WebAssembly/dwarfdump.ll
    M llvm/test/MC/WebAssembly/dwarfdump64.ll

  Log Message:
  -----------
  Reland [DwarfDebug] Move emission of global vars, types and imports to endModule()

This patch proposes to move emission of global variables, types,
imported entities, etc from DwarfDebug::beginModule() to DwarfDebug::endModule().
Effectively, this changes nothing but the order of debug entities which
will be as follows:
* subprograms (including related context, local variables/labels,
  local imported entities; related types can be created as a part of
  the emission of local entities of an abstract subprogram);
* global variables (including related context and types);
* retained types and enums;
* non-local-scoped imported entities;
* basic types;
* other types left (as a part of local variables attributes emission).

Note that the order of emitted compile units may also be changed as now we emit
units that contain subprograms first and then all other non-empty units.

The motivation behind this change is the following:
(1) DwarfDebug::beginModule() is run at the very beginning of backend's pipeline,
    from this time IR can be significantly changed by target-specific passes.
    If it happens for debug metadata of global entities, those changes will not
    be reflected in the emitted DWARF.
(2) imported subprogram names should refer to an abstract subprogram if it exists,
    but it isn't known in DwarfDebug::beginModule() (it's possible to make some
    guesses based on location info, but it's not quite reliable);
(3) aforementioned entities if they are scoped within a bracketed block
    (subject of D113741) couldn't be emitted in DwarfDebug::beginModule()
    (they need parent emitted first). Another problem is if to try to gather
    some information about local entities and defer their emission
    (till subprogram's processing or DwarfDebug::endModule()) all the gathered
    details might be irrelevant / invalid by the time the entities are being
    emitted (because of (1)).

Reviewed By: dblaikie

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


  Commit: 75b622a7959479ccdb758ebe0973061b7b4fcacd
      https://github.com/llvm/llvm-project/commit/75b622a7959479ccdb758ebe0973061b7b4fcacd
  Author: Kristina Bessonova <kbessonova at accesssoftek.com>
  Date:   2021-12-05 (Sun, 05 Dec 2021)

  Changed paths:
    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
    A llvm/test/DebugInfo/Generic/import-inlined-declaration.ll
    M llvm/test/DebugInfo/Generic/imported-name-inlined.ll
    A llvm/test/DebugInfo/Generic/inlined-local-type.ll
    A llvm/test/DebugInfo/Generic/inlined-static-var.ll
    A llvm/test/DebugInfo/Generic/lexical_block_static.ll
    A llvm/test/DebugInfo/Generic/lexical_block_types.ll
    M llvm/test/DebugInfo/Generic/namespace.ll

  Log Message:
  -----------
  Reland [DwarfDebug] Support emitting function-local declaration for a lexical block

This is another attempt to make function-local declarations
(like static variables, structs/classes and other) be correctly
emitted within a lexical (bracketed) block.

Fixes https://bugs.llvm.org/show_bug.cgi?id=19238.

Reviewed By: dblaikie

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


Compare: https://github.com/llvm/llvm-project/compare/f37d9b411222...75b622a79594


More information about the All-commits mailing list