[PATCH] D144004: [DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)
Kristina Bessonova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 17 06:30:22 PST 2023
krisb created this revision.
Herald added subscribers: ormris, steven_wu, hiraditya.
Herald added a reviewer: sscalpone.
Herald added a project: All.
krisb edited the summary of this revision.
krisb added reviewers: dblaikie, jmmartinez, ellis.
krisb added projects: LLVM, debug-info.
krisb published this revision for review.
Herald added a project: clang.
Herald added subscribers: llvm-commits, cfe-commits.
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 <https://reviews.llvm.org/D112337>).
This patch proposes two changes that get squashed to this single patch due to
their close dependencies:
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 <https://reviews.llvm.org/D144006> and D144008 <https://reviews.llvm.org/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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D144004
Files:
clang/test/CodeGenCXX/debug-info-namespace.cpp
llvm/include/llvm/IR/DIBuilder.h
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
llvm/lib/IR/DIBuilder.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Linker/IRMover.cpp
llvm/test/CodeGen/Generic/DbgValueAggregate.ll
llvm/test/DebugInfo/Generic/import-inlined-declaration.ll
llvm/test/DebugInfo/Generic/imported-name-inlined.ll
llvm/test/DebugInfo/Generic/namespace.ll
llvm/test/DebugInfo/Generic/split-dwarf-local-import.ll
llvm/test/DebugInfo/Generic/split-dwarf-local-import2.ll
llvm/test/DebugInfo/Generic/split-dwarf-local-import3.ll
llvm/test/DebugInfo/Generic/verifier-invalid-disubprogram.ll
llvm/test/DebugInfo/X86/dimodule-external-fortran.ll
llvm/test/DebugInfo/X86/dwarfdump-DIImportedEntity_elements.ll
llvm/test/DebugInfo/X86/fission-inline.ll
llvm/test/DebugInfo/X86/fission-local-import.ll
llvm/test/DebugInfo/X86/fission-no-inline-gsym.ll
llvm/test/DebugInfo/X86/lexical-block-file-inline.ll
llvm/test/DebugInfo/X86/namelist2.ll
llvm/test/DebugInfo/omit-empty.ll
llvm/test/ThinLTO/X86/debuginfo-cu-import.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144004.497297.patch
Type: text/x-patch
Size: 77117 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230217/b1b6d163/attachment-0001.bin>
More information about the cfe-commits
mailing list