DebugInfo: Generalize some tests to handle variations in attribute ordering.
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 23 May 2014 21:11:46 +0000 (21:11 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 23 May 2014 21:11:46 +0000 (21:11 +0000)
In an effort to fix inlined debug info in situations where the out of
line definition of a function preceeds any inlined usage, the order in
which some attributes are added to subprogram DIEs may change. (in
essence, definition-necessary attributes like DW_AT_low_pc/high_pc will
be added immediately, but the names, types, and other features will be
delayed to module end where they may either be added to the subprogram
DIE or instead reference an abstract definition for those values)

These tests can be generalized to be resilient to this change. 5 or so
tests actually have to be incompatibly changed to cope with this
reordering and will go along with the change that affects the order.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209554 91177308-0d34-0410-b5e6-96231b3b80d8

12 files changed:
test/DebugInfo/AArch64/variable-loc.ll
test/DebugInfo/SystemZ/variable-loc.ll
test/DebugInfo/X86/DW_AT_linkage_name.ll
test/DebugInfo/X86/arguments.ll
test/DebugInfo/X86/dbg-value-inlined-parameter.ll
test/DebugInfo/X86/debug-loc-offset.ll
test/DebugInfo/X86/gnu-public-names.ll
test/DebugInfo/X86/inline-seldag-test.ll
test/DebugInfo/X86/pr11300.ll
test/DebugInfo/namespace.ll
test/Linker/type-unique-odr-a.ll
test/MC/ARM/coff-debugging-secrel.ll

index f28ee76ebfa3857e5de3c0b1fcf29f4ab374c390..9f432d9f2c02555fbdf0ecb3a8cf825e1848a309 100644 (file)
@@ -1,4 +1,6 @@
 ; RUN: llc -mtriple=aarch64-none-linux-gnu -disable-fp-elim < %s | FileCheck %s
+; RUN: llc -mtriple=aarch64-none-linux-gnu -disable-fp-elim -filetype=obj < %s \
+; RUN:     | llvm-dwarfdump -debug-dump=info - | FileCheck --check-prefix=DEBUG %s
 
 ; This is a regression test making sure the location of variables is correct in
 ; debugging information, even if they're addressed via the frame pointer.
 ; CHECK: add x29, sp, #416
 ; CHECK: add {{x[0-9]+}}, sp, #4
 
-; CHECK: .Linfo_string7:
-; CHECK-NEXT: main_arr
-
-; Now check the debugging information reflects this:
-; CHECK: DW_TAG_variable
-; CHECK-NEXT: .word .Linfo_string7
-
-  ; Rather hard-coded, but 145 => DW_OP_fbreg and the .ascii is LEB128 encoded -412.
-; CHECK: DW_AT_location
-; CHECK-NEXT: .byte 145
-; CHECK-NEXT: .ascii "\344|"
-
-
+; DEBUG: DW_TAG_variable
+; DEBUG-NEXT: DW_AT_name {{.*}} "main_arr"
+; Rather hard-coded, but 0x91 => DW_OP_fbreg and 0xe47c is LEB128 encoded -412.
+; DEBUG: DW_AT_location {{.*}}(<0x3> 91 e4 7c )
 
 target datalayout = "e-p:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-i128:128:128-f32:32:32-f64:64:64-f128:128:128-n32:64-S128"
 target triple = "aarch64-none-linux-gnu"
index 2d92fd9edcc50d5276fde50a9626ab19c989209a..e0e4156d3957b451b8762af59a5605f18240a506 100644 (file)
@@ -1,4 +1,6 @@
 ; RUN: llc -mtriple=s390x-linux-gnu -disable-fp-elim < %s | FileCheck %s
+; RUN: llc -mtriple=s390x-linux-gnu -disable-fp-elim -filetype=obj < %s \
+; RUN:     | llvm-dwarfdump -debug-dump=info - | FileCheck --check-prefix=DEBUG %s
 ;
 ; This is a regression test making sure the location of variables is correct in
 ; debugging information, even if they're addressed via the frame pointer.
 ; CHECK: aghi    %r15, -568
 ; CHECK: la      %r2, 164(%r11)
 ; CHECK: brasl   %r14, populate_array@PLT
-;
-; CHECK: .Linfo_string7:
-; CHECK-NEXT: main_arr
-;
-; Now check that the debugging information reflects this:
-; CHECK: DW_TAG_variable
-; CHECK-NEXT: .long .Linfo_string7
-;
-; Rather hard-coded, but 145 => DW_OP_fbreg and the .ascii is the sleb128
-; encoding of 164:
-; CHECK: DW_AT_location
-; CHECK-NEXT: .byte 145
-; CHECK-NEXT: .ascii "\244\001"
-;
+
+; DEBUG: DW_TAG_variable
+; DEBUG-NOT: DW_TAG
+; DEBUG: DW_AT_name {{.*}} "main_arr"
+; Rather hard-coded, but 0x91 => DW_OP_fbreg and 0xa401 is SLEB128 encoded 164.
+; DEBUG-NOT: DW_TAG
+; DEBUG: DW_AT_location {{.*}}(<0x3> 91 a4 01 )
 
 
 @.str = private unnamed_addr constant [13 x i8] c"Total is %d\0A\00", align 2
index 76d3abbe358ce6cddd42a00dfbaf344fd609e7fa..dce234aa9002192a57f8e8c13c51278d746170d2 100644 (file)
 ; CHECK: DW_AT_name {{.*}} "~A"
 ; CHECK-NOT: DW_AT_MIPS_linkage_name
 ; CHECK: DW_TAG_subprogram
-; CHECK-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1AD2Ev"
-; CHECK-NEXT: DW_AT_specification {{.*}}[[A_DTOR]]
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1AD2Ev"
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_specification {{.*}}[[A_DTOR]]
 
 
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
index 673528455714c1fb8cafe1a276dbe0d96405fe0b..3597b2ca1dc0a2fa8d41bbb618cacb8e96005684 100644 (file)
@@ -15,7 +15,8 @@
 
 ; CHECK: debug_info contents
 ; CHECK: DW_TAG_subprogram
-; CHECK-NEXT: DW_AT_MIPS_linkage_name{{.*}}"_Z4func3fooS_"
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_MIPS_linkage_name{{.*}}"_Z4func3fooS_"
 ; CHECK-NOT: NULL
 ; CHECK: DW_TAG_formal_parameter
 ; CHECK-NEXT: DW_AT_name{{.*}}"f"
index 3db67ffdc7a4ab63f6ae1d9038116cbb520d22d8..45281c92953ef387eea35ad973142690de02655e 100644 (file)
@@ -16,7 +16,7 @@
 ;FIXME: Linux shouldn't drop this parameter either...
 ;LINUX-NOT: DW_TAG_formal_parameter
 ;DARWIN: DW_TAG_formal_parameter
-;DARWIN-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000055] = "sp")
+;DARWIN-NEXT: DW_AT_name {{.*}} "sp"
 
 %struct.S1 = type { float*, i32 }
 
index b10309c85f8ce8c708bb86c933e275c26f04c123..3f4d39da7622a0fc79568a7888b9996443c35006 100644 (file)
@@ -37,7 +37,9 @@
 ; CHECK: DW_AT_high_pc
 
 ; CHECK: DW_TAG_subprogram
-; CHECK-NEXT: DW_AT_MIPS_linkage_name [DW_FORM_strp]{{.*}}"_Z1a1A"
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_MIPS_linkage_name [DW_FORM_strp]{{.*}}"_Z1a1A"
+; CHECK-NOT: {{DW_TAG|NULL}}
 ; CHECK: DW_TAG_formal_parameter
 ; CHECK-NEXT: DW_AT_name [DW_FORM_strp]{{.*}}"var"
 ; CHECK: DW_AT_location [DW_FORM_sec_offset]   (0x00000000)
index f4001e3af927f339b638dcd9d7fa184b8c20937e..4e35dbe2b5014669bba3979d4a5485f66f170ddf 100644 (file)
 ; CHECK-NEXT: DW_AT_name {{.*}} "D"
 
 ; CHECK: [[GLOB_NS_FUNC:[0-9a-f]+]]: DW_TAG_subprogram
-; CHECK-NEXT: DW_AT_MIPS_linkage_name
-; CHECK-NEXT: DW_AT_name {{.*}} "global_namespace_function"
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_MIPS_linkage_name
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_name {{.*}} "global_namespace_function"
 
 ; CHECK: [[GLOB_NS_VAR:[0-9a-f]+]]: DW_TAG_variable
 ; CHECK-NEXT: DW_AT_specification {{.*}}[[GLOB_NS_VAR_DECL]]
 ; CHECK-NEXT: DW_AT_specification {{.*}}[[D_VAR_DECL]]
 
 ; CHECK: [[MEM_FUNC:[0-9a-f]+]]: DW_TAG_subprogram
-; CHECK-NEXT: DW_AT_specification {{.*}}[[MEM_FUNC_DECL]]
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_specification {{.*}}[[MEM_FUNC_DECL]]
 
 ; CHECK: [[STATIC_MEM_FUNC:[0-9a-f]+]]: DW_TAG_subprogram
-; CHECK-NEXT: DW_AT_specification {{.*}}[[STATIC_MEM_FUNC_DECL]]
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_specification {{.*}}[[STATIC_MEM_FUNC_DECL]]
 
 ; CHECK: [[GLOBAL_FUNC:[0-9a-f]+]]: DW_TAG_subprogram
-; CHECK-NEXT: DW_AT_MIPS_linkage_name
-; CHECK-NEXT: DW_AT_name {{.*}} "global_function"
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_MIPS_linkage_name
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_name {{.*}} "global_function"
 
 ; CHECK-LABEL: .debug_gnu_pubnames contents:
 ; CHECK-NEXT: length = 0x000000e7 version = 0x0002 unit_offset = 0x00000000 unit_size = [[UNIT_SIZE]]
 ; DWARF3-NEXT: DW_AT_name {{.*}} "D"
 
 ; DWARF3: [[GLOB_NS_FUNC:[0-9a-f]+]]: DW_TAG_subprogram
-; DWARF3-NEXT: DW_AT_MIPS_linkage_name
-; DWARF3-NEXT: DW_AT_name {{.*}} "global_namespace_function"
+; DWARF3-NOT: DW_TAG
+; DWARF3: DW_AT_MIPS_linkage_name
+; DWARF3-NOT: DW_TAG
+; DWARF3: DW_AT_name {{.*}} "global_namespace_function"
 
 ; DWARF3: [[GLOB_NS_VAR:[0-9a-f]+]]: DW_TAG_variable
 ; DWARF3-NEXT: DW_AT_specification {{.*}}[[GLOB_NS_VAR_DECL]]
 ; DWARF3-NEXT: DW_AT_specification {{.*}}[[D_VAR_DECL]]
 
 ; DWARF3: [[MEM_FUNC:[0-9a-f]+]]: DW_TAG_subprogram
-; DWARF3-NEXT: DW_AT_specification {{.*}}[[MEM_FUNC_DECL]]
+; DWARF3-NOT: DW_TAG
+; DWARF3: DW_AT_specification {{.*}}[[MEM_FUNC_DECL]]
 
 ; DWARF3: [[STATIC_MEM_FUNC:[0-9a-f]+]]: DW_TAG_subprogram
-; DWARF3-NEXT: DW_AT_specification {{.*}}[[STATIC_MEM_FUNC_DECL]]
+; DWARF3-NOT: DW_TAG
+; DWARF3: DW_AT_specification {{.*}}[[STATIC_MEM_FUNC_DECL]]
 
 ; DWARF3: [[GLOBAL_FUNC:[0-9a-f]+]]: DW_TAG_subprogram
-; DWARF3-NEXT: DW_AT_MIPS_linkage_name
-; DWARF3-NEXT: DW_AT_name {{.*}} "global_function"
+; DWARF3-NOT: DW_TAG
+; DWARF3: DW_AT_MIPS_linkage_name
+; DWARF3-NOT: DW_TAG
+; DWARF3: DW_AT_name {{.*}} "global_function"
 
 ; DWARF3-LABEL: .debug_gnu_pubnames contents:
 ; DWARF3-NEXT: length = 0x000000e7 version = 0x0002 unit_offset = 0x00000000 unit_size = [[UNIT_SIZE]]
index 83c61c4fc62c86aa9d151848677fe145faa68e69..f139140ee758dc0c555d5b388532735c37e8eced 100644 (file)
@@ -14,7 +14,8 @@
 ; CHECK: DW_TAG_inlined_subroutine
 ; CHECK-NEXT: DW_AT_abstract_origin {{.*}} {[[F:0x.*]]}
 ; CHECK: [[F]]: DW_TAG_subprogram
-; CHECK-NEXT: DW_AT_name {{.*}} "f"
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_name {{.*}} "f"
 
 
 ; Make sure the condition test is attributed to the inline function, not the
index b3c911252d839aaf93f38e9f3a59e2ad59388d75..11c409c16042f8db6bfd990ec1815527291b6ebe 100644 (file)
@@ -9,7 +9,8 @@
 ; CHECK: [[BAR_DECL:0x[0-9a-f]*]]:     DW_TAG_subprogram
 ; CHECK:     DW_AT_MIPS_linkage_name {{.*}} "_ZN3foo3barEv"
 ; CHECK: DW_TAG_subprogram
-; CHECK-NEXT: DW_AT_specification {{.*}} {[[BAR_DECL]]}
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_specification {{.*}} {[[BAR_DECL]]}
 
 %struct.foo = type { i8 }
 
index 6af3dc3ddd9cfe74e0bd67ae989a1718aa917257..ca5cf808d180a7d566280346e87b63ddd94c0d95 100644 (file)
 ; CHECK-NEXT: DW_AT_name{{.*}}= "i"
 ; CHECK-NOT: NULL
 ; CHECK: DW_TAG_subprogram
-; CHECK-NEXT: DW_AT_MIPS_linkage_name
-; CHECK-NEXT: DW_AT_name{{.*}}= "f1"
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_MIPS_linkage_name
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_name{{.*}}= "f1"
 ; CHECK: [[FUNC1:0x[0-9a-f]*]]:{{ *}}DW_TAG_subprogram
-; CHECK-NEXT: DW_AT_MIPS_linkage_name
-; CHECK-NEXT: DW_AT_name{{.*}}= "f1"
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_MIPS_linkage_name
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_name{{.*}}= "f1"
 ; CHECK: NULL
 ; CHECK-NOT: NULL
 ; CHECK: [[FOO:0x[0-9a-f]*]]:{{ *}}DW_TAG_structure_type
 ; CHECK-NOT: NULL
 
 ; CHECK: DW_TAG_subprogram
-; CHECK-NEXT: DW_AT_MIPS_linkage_name
-; CHECK-NEXT: DW_AT_name{{.*}}= "func"
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_MIPS_linkage_name
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_name{{.*}}= "func"
 ; CHECK-NOT: NULL
 ; CHECK: DW_TAG_imported_module
 ; CHECK-NEXT: DW_AT_decl_file{{.*}}(0x0[[F2]])
index a1b8d28e64500c4c880a3e73d0f9726a699ed18c..54befb75ba450246c0e71dc72719a1707231a4f0 100644 (file)
 ; }
 ;
 ; CHECK:      DW_TAG_subprogram
-; CHECK-NEXT:   DW_AT_MIPS_linkage_name {{.*}} "_Z3bazv"
+; CHECK-NOT: DW_TAG
+; CHECK:   DW_AT_MIPS_linkage_name {{.*}} "_Z3bazv"
 ; CHECK:      DW_TAG_subprogram
-; CHECK-NEXT:   DW_AT_MIPS_linkage_name {{.*}} "_ZL3barv"
+; CHECK-NOT: DW_TAG
+; CHECK:   DW_AT_MIPS_linkage_name {{.*}} "_ZL3barv"
 ; CHECK:      DW_TAG_class_type
 ; CHECK-NEXT:   DW_AT_name {{.*}} "A"
 ; CHECK-NOT:  DW_TAG
 ; CHECK-NEXT:   DW_AT_name {{.*}} "data"
 ; CHECK-NOT:  DW_TAG
 ; CHECK:      DW_TAG_subprogram
-; CHECK-NEXT:   DW_AT_MIPS_linkage_name {{.*}} "_ZN1A6getFooEv"
-; CHECK-NEXT:   DW_AT_name {{.*}} "getFoo"
+; CHECK-NOT: DW_TAG
+; CHECK:   DW_AT_MIPS_linkage_name {{.*}} "_ZN1A6getFooEv"
+; CHECK-NOT: DW_TAG
+; CHECK:   DW_AT_name {{.*}} "getFoo"
 
 ; getFoo and A may only appear once.
 ; CHECK-NOT:  {{(getFoo)|("A")}}
index a6c52db4adaf92498f57d0ffba991b501c67d912..f37b19e6a70c6ba46dea3e92bb6d44bc1dcd3e73 100644 (file)
@@ -34,8 +34,6 @@ entry:
 ; CHECK-ITANIUM:     0xC IMAGE_REL_ARM_SECREL .debug_str
 ; CHECK-ITANIUM:     0x12 IMAGE_REL_ARM_SECREL .debug_str
 ; CHECK-ITANIUM:     0x16 IMAGE_REL_ARM_SECREL .debug_line
-; CHECK-ITANIUM:     0x1A IMAGE_REL_ARM_SECREL .debug_str
-; CHECK-ITANIUM:     0x27 IMAGE_REL_ARM_SECREL .debug_str
 ; CHECK-ITANIUM:   }
 ; CHECK-ITANIUM:   Section {{.*}}.debug_pubnames {
 ; CHECK-ITANIUM:     0x6 IMAGE_REL_ARM_SECREL .debug_info