From 620f436b205ab75e1dd48b9af8823bc30c53fd0e Mon Sep 17 00:00:00 2001 From: Manman Ren Date: Tue, 1 Oct 2013 19:52:23 +0000 Subject: Debug Info: remove duplication of DIEs when a DIE is part of the type system and it is shared across CUs. We add a few maps in DwarfDebug to map MDNodes for the type system to the corresponding DIEs: MDTypeNodeToDieMap, MDSPNodeToDieMap, and MDStaticMemberNodeToDieMap. These DIEs can be shared across CUs, that is why we keep the maps in DwarfDebug instead of CompileUnit. Sometimes, when we try to add an attribute to a DIE, the DIE is not yet added to its owner yet, so we don't know whether we should use ref_addr or ref4. We create a worklist that will be processed during finalization to add attributes with the correct form (ref_addr or ref4). We add addDIEEntry to DwarfDebug to be a wrapper around DIE->addValue. It checks whether we know the correct form, if not, we update the worklist (DIEEntryWorklist). A testing case is added to show that we only create a single DIE for a type MDNode and we use ref_addr to refer to the type DIE. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191792 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Linker/type-unique-simple-a.ll | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'test/Linker') diff --git a/test/Linker/type-unique-simple-a.ll b/test/Linker/type-unique-simple-a.ll index 7c2e7bfa90..251e5b3424 100644 --- a/test/Linker/type-unique-simple-a.ll +++ b/test/Linker/type-unique-simple-a.ll @@ -1,7 +1,22 @@ -; RUN: llvm-link %s %p/type-unique-simple-b.ll -S -o - | FileCheck %s +; REQUIRES: object-emission -; CHECK: DW_TAG_structure_type +; RUN: llvm-link %s %p/type-unique-simple-b.ll -S -o %t +; RUN: cat %t | FileCheck %s -check-prefix=LINK +; RUN: llc -filetype=obj -O0 < %t > %t2 +; RUN: llvm-dwarfdump -debug-dump=info %t2 | FileCheck %s +; CHECK: 0x[[INT:.*]]: DW_TAG_base_type +; CHECK-NEXT: DW_AT_name {{.*}} = "int" +; CHECK-NOT: DW_TAG_base_type +; CHECK: 0x[[BASE:.*]]: DW_TAG_structure_type +; CHECK-NEXT: DW_AT_name {{.*}} = "Base" ; CHECK-NOT: DW_TAG_structure_type +; CHECK: DW_TAG_formal_parameter +; CHECK: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[INT]]) +; CHECK: DW_TAG_variable +; CHECK: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[BASE]]) + +; LINK: DW_TAG_structure_type +; LINK-NOT: DW_TAG_structure_type ; Content of header files: ; struct Base { ; int a; -- cgit v1.2.3