[llvm] b4bffdb - Revert "PR44685: DebugInfo: Handle address-use-invalid type units referencing non-type units"

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 05:41:02 PDT 2020


Author: Nico Weber
Date: 2020-08-18T08:40:36-04:00
New Revision: b4bffdbadfcceb3959aaf231c1542301944e5812

URL: https://github.com/llvm/llvm-project/commit/b4bffdbadfcceb3959aaf231c1542301944e5812
DIFF: https://github.com/llvm/llvm-project/commit/b4bffdbadfcceb3959aaf231c1542301944e5812.diff

LOG: Revert "PR44685: DebugInfo: Handle address-use-invalid type units referencing non-type units"

This reverts commit be3ef93bf58aa5546c7baadfb21d43b75fbb4e24.
Test fails on macOS and Windows, e.g. http://45.33.8.238/win/22216/step_11.txt

Added: 
    

Modified: 
    llvm/lib/CodeGen/AsmPrinter/AddressPool.h
    llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h

Removed: 
    llvm/test/DebugInfo/X86/addr-tu-to-non-tu.ll


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/AddressPool.h b/llvm/lib/CodeGen/AsmPrinter/AddressPool.h
index f1edc6c330d5..f92cf72093ca 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AddressPool.h
+++ b/llvm/lib/CodeGen/AsmPrinter/AddressPool.h
@@ -48,7 +48,7 @@ class AddressPool {
 
   bool hasBeenUsed() const { return HasBeenUsed; }
 
-  void resetUsedFlag(bool HasBeenUsed = false) { this->HasBeenUsed = HasBeenUsed; }
+  void resetUsedFlag() { HasBeenUsed = false; }
 
   MCSymbol *getLabel() { return AddressTableBaseSym; }
   void setLabel(MCSymbol *Sym) { AddressTableBaseSym = Sym; }

diff  --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index cee72120accb..f70eed32f0b5 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -3305,14 +3305,14 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
 
 DwarfDebug::NonTypeUnitContext::NonTypeUnitContext(DwarfDebug *DD)
     : DD(DD),
-      TypeUnitsUnderConstruction(std::move(DD->TypeUnitsUnderConstruction)), AddrPoolUsed(DD->AddrPool.hasBeenUsed()) {
+      TypeUnitsUnderConstruction(std::move(DD->TypeUnitsUnderConstruction)) {
   DD->TypeUnitsUnderConstruction.clear();
-  DD->AddrPool.resetUsedFlag();
+  assert(TypeUnitsUnderConstruction.empty() || !DD->AddrPool.hasBeenUsed());
 }
 
 DwarfDebug::NonTypeUnitContext::~NonTypeUnitContext() {
   DD->TypeUnitsUnderConstruction = std::move(TypeUnitsUnderConstruction);
-  DD->AddrPool.resetUsedFlag(AddrPoolUsed);
+  DD->AddrPool.resetUsedFlag();
 }
 
 DwarfDebug::NonTypeUnitContext DwarfDebug::enterNonTypeUnitContext() {

diff  --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index 93e08d1151ff..0b943ebe46b6 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -648,7 +648,6 @@ class DwarfDebug : public DebugHandlerBase {
   class NonTypeUnitContext {
     DwarfDebug *DD;
     decltype(DwarfDebug::TypeUnitsUnderConstruction) TypeUnitsUnderConstruction;
-    bool AddrPoolUsed;
     friend class DwarfDebug;
     NonTypeUnitContext(DwarfDebug *DD);
   public:

diff  --git a/llvm/test/DebugInfo/X86/addr-tu-to-non-tu.ll b/llvm/test/DebugInfo/X86/addr-tu-to-non-tu.ll
deleted file mode 100644
index 98943b73aefe..000000000000
--- a/llvm/test/DebugInfo/X86/addr-tu-to-non-tu.ll
+++ /dev/null
@@ -1,89 +0,0 @@
-; RUN: llc -filetype=obj -O0 -generate-type-units -split-dwarf-file=x.dwo < %s \
-; RUN:     | llvm-dwarfdump -debug-info -debug-types - \
-; RUN:     | FileCheck --implicit-check-not=Unit --implicit-check-not=contents --implicit-check-not=declaration %s
-
-; Test that an address-using-with-Split-DWARF type unit that references a
-; non-type unit is handled correctly. A NonTypeUnitContext is used to insulate
-; the type construction from being discarded when the prior/outer type has to be
-; discarded due to finding it used an address & so can't be type united under
-; Split DWARF. 
-
-; The intermediate types tu and t2 are here just to test a bit more
-; thoroughly/broadly. They also demonstrate one slight limitation/sub-optimality
-; since 't2' isn't put in a type unit.
-
-
-; extern int foo;
-; namespace {
-; struct t1 {
-; };
-; }
-; template <int *> struct t2 {
-;   t1 v1;
-; };
-; struct t3 {
-;   t2<&foo> v1;
-; };
-; t3 v1;
-
-; CHECK: .debug_info contents:
-; CHECK: Compile Unit:
-
-; CHECK: .debug_info.dwo contents:
-; CHECK: Compile Unit:
-
-; FIXME: In theory "t3" could be in a type unit - but at the moment, because it
-;        references t2, which needs an address, t3 gets non-type-united.
-;        But the same doesn't happen if t3 referenced an anonymous namespace type.
-
-; CHECK: DW_TAG_structure_type
-; CHECK:   DW_AT_name ("t3")
-; CHECK:   DW_TAG_member
-; CHECK:     DW_AT_type {{.*}} "t2<&foo>"
-; CHECK: DW_TAG_namespace
-; CHECK: [[T1:0x[0-9a-f]*]]:  DW_TAG_structure_type
-; CHECK:     DW_AT_name    ("t1")
-; CHECK: DW_TAG_structure_type
-; CHECK:   DW_AT_name ("t2<&foo>")
-; CHECK:   DW_TAG_member
-; CHECK:     DW_AT_name    ("v1")
-; CHECK:     DW_AT_type    ([[T1]] "t1")
-
-; CHECK: .debug_types contents:
-
-; CHECK-NOT: .debug_types.dwo contents:
-
-
-%struct.t3 = type { %struct.t2 }
-%struct.t2 = type { %"struct.(anonymous namespace)::t1" }
-%"struct.(anonymous namespace)::t1" = type { i8 }
-
- at v1 = dso_local global %struct.t3 zeroinitializer, align 1, !dbg !0
- at foo = external dso_local global i32, align 4
-
-!llvm.dbg.cu = !{!2}
-!llvm.module.flags = !{!18, !19, !20}
-!llvm.ident = !{!21}
-
-!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
-!1 = distinct !DIGlobalVariable(name: "v1", scope: !2, file: !3, line: 16, type: !6, isLocal: false, isDefinition: true)
-!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 12.0.0 (git at github.com:llvm/llvm-project.git be646ae2865371c7a4966797e88f355de5653e04)", isOptimized: false, runtimeVersion: 0, splitDebugFilename: "test.dwo", emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: GNU)
-!3 = !DIFile(filename: "test.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")
-!4 = !{}
-!5 = !{!0}
-!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t3", file: !3, line: 12, size: 8, flags: DIFlagTypePassByValue, elements: !7, identifier: "_ZTS2t3")
-!7 = !{!8}
-!8 = !DIDerivedType(tag: DW_TAG_member, name: "v1", scope: !6, file: !3, line: 13, baseType: !9, size: 8)
-!9 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t2<&foo>", file: !3, line: 8, size: 8, flags: DIFlagTypePassByValue, elements: !10, templateParams: !14, identifier: "_ZTS2t2IXadL_Z3fooEEE")
-!10 = !{!11}
-!11 = !DIDerivedType(tag: DW_TAG_member, name: "v1", scope: !9, file: !3, line: 9, baseType: !12, size: 8)
-!12 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t1", scope: !13, file: !3, line: 4, size: 8, flags: DIFlagTypePassByValue, elements: !4)
-!13 = !DINamespace(scope: null)
-!14 = !{!15}
-!15 = !DITemplateValueParameter(type: !16, value: i32* @foo)
-!16 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !17, size: 64)
-!17 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-!18 = !{i32 7, !"Dwarf Version", i32 4}
-!19 = !{i32 2, !"Debug Info Version", i32 3}
-!20 = !{i32 1, !"wchar_size", i32 4}
-!21 = !{!"clang version 12.0.0 (git at github.com:llvm/llvm-project.git be646ae2865371c7a4966797e88f355de5653e04)"}


        


More information about the llvm-commits mailing list