Linker: Stop using -gmlt test/Linker/subprogram-linkonce-weak.ll

As dblaikie pointed out, if I stop setting `emissionKind: 2` then the
backend won't do magical things on Linux vs. Darwin.  I had wrongly
assumed that there were stricter requirements on the input if we weren't
in line-tables-only mode, but apparently not.

With that knowledge, clean up this testcase a little more.

  - Set `emissionKind: 1`.
  - Add back checks for the weak version of @foo.
  - Check more robustly that we have the right subprograms by checking
    the `DW_AT_decl_file` and `DW_AT_decl_line` which now show up.
  - Check the line table in isolation (since it's no longer doubling as
    an indirect test for the subprogram of the weak version of @foo).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233221 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-03-25 21:36:41 +00:00
parent 5b99ebad2c
commit 00aafa5d73
2 changed files with 36 additions and 23 deletions

View File

@ -10,7 +10,7 @@ declare i32 @fastadd(i32, i32)
!0 = !{i32 2, !"Debug Info Version", i32 3}
!llvm.dbg.cu = !{!1}
!1 = !MDCompileUnit(language: DW_LANG_C99, file: !2, subprograms: !{!3}, emissionKind: 2)
!1 = !MDCompileUnit(language: DW_LANG_C99, file: !2, subprograms: !{!3}, emissionKind: 1)
!2 = !MDFile(filename: "foo.c", directory: "/path/to/dir")
!3 = !MDSubprogram(file: !2, scope: !2, line: 51, name: "foo", function: i32 (i32, i32)* @foo, type: !4)
!4 = !MDSubroutineType(types: !{})

View File

@ -87,7 +87,7 @@ entry:
; WL: ![[BARIA]] = !MDLocation(line: 12, scope: ![[BARSP]])
; WL: ![[BARRET]] = !MDLocation(line: 13, scope: ![[BARSP]])
!1 = !MDCompileUnit(language: DW_LANG_C99, file: !2, subprograms: !{!3, !4}, emissionKind: 2)
!1 = !MDCompileUnit(language: DW_LANG_C99, file: !2, subprograms: !{!3, !4}, emissionKind: 1)
!2 = !MDFile(filename: "bar.c", directory: "/path/to/dir")
!3 = !MDSubprogram(file: !2, scope: !2, line: 11, name: "bar", function: i32 (i32, i32)* @bar, type: !5)
!4 = !MDSubprogram(file: !2, scope: !2, line: 1, name: "foo", function: i32 (i32, i32)* @foo, type: !5)
@ -99,60 +99,73 @@ entry:
; RUN: llvm-dwarfdump %t1.o -debug-dump=all | FileCheck %s -check-prefix=DWLW -check-prefix=DW
; RUN: %llc_dwarf -filetype=obj -O0 %t2 -o %t2.o
; RUN: llvm-dwarfdump %t2.o -debug-dump=all | FileCheck %s -check-prefix=DWWL -check-prefix=DW
; Don't check for the DW_TAG_subprogram for the weak version of @foo. It has
; no inlined subroutines, so with -gmlt may not exist (debuggers can find the
; aranges in the compile unit and look in the line table directly). See the
; checks against the line table that follow.
; Check that the debug info for the discarded linkonce version of @foo doesn't
; reference any code, and that the other subprograms look correct.
; DW-LABEL: .debug_info contents:
; DWLW: DW_TAG_compile_unit
; DWLW: DW_AT_name {{.*}}"bar.c"
; DWLW: DW_AT_low_pc [DW_FORM_addr] ([[BARLOW:0x[0-9a-f]+]])
; DWLW: DW_TAG_subprogram
; DWLW-NOT: DW_AT_{{[lowhigh]*}}_pc
; DWLW-NOT: DW_AT_low_pc
; DWLW-NOT: DW_AT_high_pc
; DWLW: DW_AT_name {{.*}}foo
; DWLW-NOT: DW_AT_{{[lowhigh]*}}_pc
; DWLW: DW_AT_decl_file {{.*}}"/path/to/dir/bar.c"
; DWLW: DW_AT_decl_line {{.*}}(1)
; DWLW: DW_TAG_subprogram
; DWLW: DW_AT_low_pc
; DWLW: DW_AT_high_pc
; DWLW: DW_AT_name {{.*}}bar
; DWLW: DW_AT_decl_file {{.*}}"/path/to/dir/bar.c"
; DWLW: DW_AT_decl_line {{.*}}(11)
; DWLW: DW_TAG_inlined_subroutine
; DWLW: DW_AT_abstract_origin
; DWLW: DW_TAG_compile_unit
; DWLW: DW_AT_name {{.*}}"foo.c"
; DWLW: DW_AT_low_pc [DW_FORM_addr] ([[FOOLOW:0x[0-9a-f]+]])
; DWLW: DW_TAG_subprogram
; DWLW: DW_AT_low_pc
; DWLW: DW_AT_high_pc
; DWLW: DW_AT_name {{.*}}foo
; DWLW: DW_AT_decl_file {{.*}}"/path/to/dir/foo.c"
; DWLW: DW_AT_decl_line {{.*}}(51)
; The DWARF output is already symmetric (just reordered).
; DWWL: DW_TAG_compile_unit
; DWWL: DW_AT_name {{.*}}"foo.c"
; DWWL: DW_AT_low_pc [DW_FORM_addr] ([[FOOLOW:0x[0-9a-f]+]])
; DWWL: DW_TAG_subprogram
; DWWL: DW_AT_low_pc
; DWWL: DW_AT_high_pc
; DWWL: DW_AT_name {{.*}}foo
; DWWL: DW_AT_decl_file {{.*}}"/path/to/dir/foo.c"
; DWWL: DW_AT_decl_line {{.*}}(51)
; DWWL: DW_TAG_compile_unit
; DWWL: DW_AT_name {{.*}}"bar.c"
; DWWL: DW_AT_low_pc [DW_FORM_addr] ([[BARLOW:0x[0-9a-f]+]])
; DWWL: DW_TAG_subprogram
; DWWL-NOT: DW_AT_{{[lowhigh]*}}_pc
; DWWL-NOT: DW_AT_low_pc
; DWWL-NOT: DW_AT_high_pc
; DWWL: DW_AT_name {{.*}}foo
; DWWL-NOT: DW_AT_{{[lowhigh]*}}_pc
; DWWL: DW_AT_decl_file {{.*}}"/path/to/dir/bar.c"
; DWWL: DW_AT_decl_line {{.*}}(1)
; DWWL: DW_TAG_subprogram
; DWWL: DW_AT_low_pc
; DWWL: DW_AT_high_pc
; DWWL: DW_AT_name {{.*}}bar
; DWWL: DW_AT_decl_file {{.*}}"/path/to/dir/bar.c"
; DWWL: DW_AT_decl_line {{.*}}(11)
; DWWL: DW_TAG_inlined_subroutine
; DWWL: DW_AT_abstract_origin
; DW-LABEL: .debug_line contents:
; Check that the low_pc entries from above hit the right files.
; Check that we have the right things in the line table as well.
; DWLW-LABEL: file_names[{{ *}}1]{{.*}} bar.c
; DWLW: [[BARLOW]] 0 0 1 0 0 is_stmt
; DWLW: 2 0 1 0 0 is_stmt prologue_end
; DWLW: 2 0 1 0 0 is_stmt prologue_end
; DWLW-LABEL: file_names[{{ *}}1]{{.*}} foo.c
; DWLW: [[FOOLOW]] 0 0 1 0 0 is_stmt
; DWLW: 52 0 1 0 0 is_stmt prologue_end
; DWLW: 52 0 1 0 0 is_stmt prologue_end
; DWLW-NOT: prologue_end
; DWWL-LABEL: file_names[{{ *}}1]{{.*}} foo.c
; DWWL: [[FOOLOW]] 0 0 1 0 0 is_stmt
; DWWL: 52 0 1 0 0 is_stmt prologue_end
; DWWL: 52 0 1 0 0 is_stmt prologue_end
; DWWL-LABEL: file_names[{{ *}}1]{{.*}} bar.c
; DWWL: [[BARLOW]] 0 0 1 0 0 is_stmt
; DWWL: 2 0 1 0 0 is_stmt prologue_end
; DWWL: 2 0 1 0 0 is_stmt prologue_end
; DWWL-NOT: prologue_end