[PATCH] D113741: [RFC][DwarfDebug][AsmPrinter] Support emitting function-local declaration for a lexical block

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 13:49:40 PDT 2022


dblaikie added a comment.

In D113741#3538747 <https://reviews.llvm.org/D113741#3538747>, @dblaikie wrote:

> Right, so this does only reproduce with Split DWARF + Split DWARF inlining + ThinLTO, I think. The CUs for the imported units Split DWARF inlining are being designated as split units, but then split units aren't actually emitted (because of the single-unit limitation of Split DWARF) and so the pubnames are emitted for DIEs that were never layed out/emitted, by the looks of it, so they get an offset of zero, which looks like/creates a truncated pubnames contribution.
>
> Trying to make a small reproducer.

OK, think I've got something in IR at least. Looks like it could be reproduced from source + LTO probably. With an assertions-enabled build of LLVM/Clang:

  define void @f1() !dbg !13 {
  lbl:
    ret void, !dbg !16
  }
  
  define void @f2() !dbg !22 {
  lbl:
    ret void, !dbg !23
  }
  
  !llvm.dbg.cu = !{!0, !2, !10}
  !llvm.module.flags = !{!12}
  
  !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, emissionKind: FullDebug)
  !1 = !DIFile(filename: "a.cc", directory: "")
  !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, emissionKind: FullDebug, imports: !4)
  !3 = !DIFile(filename: "b.cc", directory: "")
  !4 = !{!5}
  !5 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !6, entity: !7)
  !6 = !DISubprogram(scope: null, spFlags: DISPFlagOptimized)
  !7 = !DINamespace(scope: !2)
  !8 = !DISubroutineType(types: !9)
  !9 = !{}
  !10 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !11, emissionKind: FullDebug)
  !11 = !DIFile(filename: "c.cc", directory: "")
  !12 = !{i32 2, !"Debug Info Version", i32 3}
  !13 = distinct !DISubprogram(scope: null, type: !8, spFlags: DISPFlagDefinition, unit: !0)
  !16 = !DILocation(line: 0, scope: !17, inlinedAt: !18)
  !17 = distinct !DISubprogram(scope: null, unit: !10)
  !18 = !DILocation(line: 0, scope: !21)
  !21 = !DILexicalBlockFile(scope: !13, discriminator: 0)
  !22 = distinct !DISubprogram(scope: null, type: !8, spFlags: DISPFlagDefinition, unit: !0)
  !23 = !DILocation(line: 0, scope: !24, inlinedAt: !25)
  !24 = distinct !DISubprogram(scope: null, unit: !2)
  !25 = !DILocation(line: 0, scope: !22)

  clang -cc1 -emit-obj  -split-dwarf-file x.dwo x.ll

Does that work for you?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113741/new/

https://reviews.llvm.org/D113741



More information about the llvm-commits mailing list