[llvm] r349528 - DebugInfo: Fix missing local imported entities after r349207

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 18 11:40:23 PST 2018


Author: dblaikie
Date: Tue Dec 18 11:40:22 2018
New Revision: 349528

URL: http://llvm.org/viewvc/llvm-project?rev=349528&view=rev
Log:
DebugInfo: Fix missing local imported entities after r349207

Post commit review/bug reported by Pavel Labath - thanks!

Added:
    llvm/trunk/test/DebugInfo/X86/fission-local-import.ll
Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=349528&r1=349527&r2=349528&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Dec 18 11:40:22 2018
@@ -573,9 +573,6 @@ void DwarfDebug::finishUnitAttributes(co
   DIE &Die = NewCU.getUnitDie();
   StringRef FN = DIUnit->getFilename();
 
-  for (auto *IE : DIUnit->getImportedEntities())
-    NewCU.addImportedEntity(IE);
-
   // LTO with assembly output shares a single line table amongst multiple CUs.
   // To avoid the compilation directory being ambiguous, let the line table
   // explicitly describe the directory of all files, never relying on the
@@ -649,6 +646,9 @@ DwarfDebug::getOrCreateDwarfCompileUnit(
   DwarfCompileUnit &NewCU = *OwnedUnit;
   InfoHolder.addUnit(std::move(OwnedUnit));
 
+  for (auto *IE : DIUnit->getImportedEntities())
+    NewCU.addImportedEntity(IE);
+
   if (useSplitDwarf()) {
     NewCU.setSkeleton(constructSkeletonCU(NewCU));
     NewCU.setSection(Asm->getObjFileLowering().getDwarfInfoDWOSection());

Added: llvm/trunk/test/DebugInfo/X86/fission-local-import.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/fission-local-import.ll?rev=349528&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/fission-local-import.ll (added)
+++ llvm/trunk/test/DebugInfo/X86/fission-local-import.ll Tue Dec 18 11:40:22 2018
@@ -0,0 +1,33 @@
+; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
+; RUN: llvm-dwarfdump %t | FileCheck %s
+
+; CHECK: .debug_info.dwo contents:
+; CHECK: DW_TAG_compile_unit
+; CHECK:   DW_TAG_subprogram
+; CHECK:     DW_TAG_imported_module
+
+; Function Attrs: noinline nounwind optnone uwtable
+define dso_local void @_Z4testv() !dbg !5 {
+entry:
+  ret void, !dbg !13
+}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!9, !10, !11}
+!llvm.ident = !{!12}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 8.0.0 (trunk 349508) (llvm/trunk 349520)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, imports: !3, nameTableKind: None)
+!1 = !DIFile(filename: "test.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")
+!2 = !{}
+!3 = !{!4}
+!4 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !5, entity: !8, file: !1, line: 2)
+!5 = distinct !DISubprogram(name: "test", linkageName: "_Z4testv", scope: !1, file: !1, line: 2, type: !6, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
+!6 = !DISubroutineType(types: !7)
+!7 = !{null}
+!8 = !DINamespace(name: "ns1", scope: null)
+!9 = !{i32 2, !"Dwarf Version", i32 4}
+!10 = !{i32 2, !"Debug Info Version", i32 3}
+!11 = !{i32 1, !"wchar_size", i32 4}
+!12 = !{!"clang version 8.0.0 (trunk 349508) (llvm/trunk 349520)"}
+!13 = !DILocation(line: 2, column: 36, scope: !5)
+




More information about the llvm-commits mailing list