[PATCH] D125693: [DebugInfo][WIP] Support types, imports and static locals declared in a lexical block (3/5)

Kristina Bessonova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 16 08:38:57 PDT 2022


krisb created this revision.
krisb added reviewers: dblaikie, aprantl, probinson, ellis, jmorse.
Herald added subscribers: ormris, pengfei, steven_wu, hiraditya, nemanjai.
Herald added a reviewer: sscalpone.
Herald added a project: All.
krisb requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

This an alternative implementation for D113741 <https://reviews.llvm.org/D113741> which relies on localDecls
field of DISubprogram or DILexicalBlock for getting local declarations
(types, imports or static variable) for a particular local scope.

It has 2 issues from D113741 <https://reviews.llvm.org/D113741> resolved:

- Previous patch may misscope type declarations belong to a lexical block. This happened because there wasn't possible to know if there are any types belong to a particular local scope by the time we started to emit this scope. So, we may skip emission of lexical blocks even if they contain some type declarations, and later couldn't find a proper parent for those types. localDecls track all the types declared within a particular local scope, so we no longer skip non-empty lexical blocks.

- Previous patch didn't have a mapping between a local declaration and its containing subprogram DIE (and CU DIE), which may cause issues like https://reviews.llvm.org/D113741#3206883. Now we are able to create such mapping basing on localDecls of DISubprogram or DILexicalBlock.

Another thing that should be noted that with this patch we will no longer emit local
declarations if its parent scope doesn't have a LexicalScope calculated for it
(i.e. there are no DILocations that point to this scope or any of its children scopes)
unless something refers such a declaration (relevant for types), see
changes in llvm/test/Instrumentation/InstrProfiling/debug-info-correlate.ll as an example.
I guess this shouldn't affect debugging experience.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125693

Files:
  clang/test/CodeGen/debug-info-codeview-unnamed.c
  clang/test/CodeGen/debug-info-unused-types.c
  clang/test/CodeGen/debug-info-unused-types.cpp
  clang/test/CodeGenCXX/debug-info-anon-union-vars.cpp
  clang/test/CodeGenCXX/debug-info-codeview-unnamed.cpp
  clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp
  clang/test/CodeGenCXX/debug-info-namespace.cpp
  clang/test/CodeGenCXX/debug-lambda-this.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/Linker/IRMover.cpp
  llvm/test/CodeGen/AArch64/arm64-2011-03-17-AsmPrinterCrash.ll
  llvm/test/CodeGen/BPF/BTF/static-var-inited-sec.ll
  llvm/test/CodeGen/BPF/BTF/static-var-inited.ll
  llvm/test/CodeGen/BPF/BTF/static-var-readonly-sec.ll
  llvm/test/CodeGen/BPF/BTF/static-var-readonly.ll
  llvm/test/CodeGen/BPF/BTF/static-var-sec.ll
  llvm/test/CodeGen/BPF/BTF/static-var.ll
  llvm/test/CodeGen/BPF/dwarfdump.ll
  llvm/test/CodeGen/PowerPC/pr24546.ll
  llvm/test/CodeGen/X86/dbg-distringtype-uint.ll
  llvm/test/DebugInfo/Generic/2009-11-05-DeadGlobalVariable.ll
  llvm/test/DebugInfo/Generic/import-inlined-declaration.ll
  llvm/test/DebugInfo/Generic/imported-name-inlined.ll
  llvm/test/DebugInfo/Generic/inlined-local-type.ll
  llvm/test/DebugInfo/Generic/inlined-static-var.ll
  llvm/test/DebugInfo/Generic/lexical-block-retained-types.ll
  llvm/test/DebugInfo/Generic/lexical-block-static-var.ll
  llvm/test/DebugInfo/Generic/lexical-block-types.ll
  llvm/test/DebugInfo/Generic/namespace.ll
  llvm/test/DebugInfo/Generic/split-dwarf-local-import.ll
  llvm/test/DebugInfo/X86/DW_AT_specification.ll
  llvm/test/DebugInfo/X86/dimodule-external-fortran.ll
  llvm/test/DebugInfo/X86/distringtype.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/gnu-public-names.ll
  llvm/test/DebugInfo/X86/lexical-block-file-inline.ll
  llvm/test/DebugInfo/X86/namelist1.ll
  llvm/test/DebugInfo/X86/namelist2.ll
  llvm/test/DebugInfo/omit-empty.ll
  llvm/test/Instrumentation/InstrProfiling/debug-info-correlate.ll
  llvm/test/ThinLTO/X86/debuginfo-cu-import.ll
  llvm/unittests/Transforms/Utils/CloningTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125693.429727.patch
Type: text/x-patch
Size: 149267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220516/7e1966d9/attachment-0001.bin>


More information about the llvm-commits mailing list