[llvm] r233207 - Linker: Rewrite dwarfdump checks from r233164

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed Mar 25 14:14:49 PDT 2015


> On 2015-Mar-25, at 14:11, David Blaikie <dblaikie at gmail.com> wrote:
> 
> 
> 
> On Wed, Mar 25, 2015 at 2:08 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
> 
> > On 2015-Mar-25, at 13:06, David Blaikie <dblaikie at gmail.com> wrote:
> >
> >
> >
> > On Wed, Mar 25, 2015 at 12:57 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
> > Author: dexonsmith
> > Date: Wed Mar 25 14:57:42 2015
> > New Revision: 233207
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=233207&view=rev
> > Log:
> > Linker: Rewrite dwarfdump checks from r233164
> >
> > Rewrite the checks from r233164 that I temporarily disabled in r233165.
> >
> > It turns out that the line-tables only debug info we emit from `llc` is
> > (intentionally) different on Linux than on Darwin.
> >
> > Does this need to test gmlt rather than normal -g?
> 
> I suppose not, but it's easier to hand-write line-tables only debug info,

Really?!  I had assumed the backend required more fidelity or details or
something when not in `-gmlt` mode.  I'll play around.

> 
> You can create minimal debug inof by hand without making it "gmlt" debug info - don't set that gmlt flag on the CU and it shouldn't do the magical "minimal subprogram" thing on non-darwin anymore.
>  
> and that should be sufficient for checking if the correct subprogram is
> around.
> 
> >
> > If it does need to test gmlt, which bits of it does it need to test? Is the functionality you want to test actually used in both Darwin and non-Darwin, or is it only under the non-Darwin "skip unnecessary subprogram" stuff I implemented? (in which cas running the test on Darwin doesn't actually tell you anything about whether the functionality is working - so it might be more suitable to use a fixed triple?)
> 
> I want to test:
> 
>  1. That the merged IR zeros out Functions (although I imagine this could
>     change eventually).
>  2. That `llc` doesn't crash.
>  3. That in the output DWARF, the debug info from the `weak` version of
>     `@foo` is what's actually used (not the debug info from the discarded
>     `linkonce` version of `@foo`).
> 
> All these things should be true for both Linux and Darwin (and any other
> platform we support, I think).
> 
> >
> > r218129 started
> > skipping emission of subprograms with no inlined subroutines, and
> > r218702 was a spiritual revert of that behaviour for Darwin.
> >
> > I think we can still test this in a platform-neutral way.
> >
> >   - Stop checking for the possibly missing `DW_TAG_subprogram` defining
> >     the debug info for the real version of `@foo`.
> >   - Start checking the line tables, ensuring that the right debug info
> >     was used to generate them (grabbing `DW_AT_low_pc` from the compile
> >     unit).
> >   - I changed up the line numbers used in the "weak" version so it's
> >     easier to follow.
> >
> > This should hopefully finish off PR22792.
> >
> > Modified:
> >     llvm/trunk/test/Linker/Inputs/subprogram-linkonce-weak.ll
> >     llvm/trunk/test/Linker/subprogram-linkonce-weak.ll
> >
> > Modified: llvm/trunk/test/Linker/Inputs/subprogram-linkonce-weak.ll
> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/Inputs/subprogram-linkonce-weak.ll?rev=233207&r1=233206&r2=233207&view=diff
> > ==============================================================================
> > --- llvm/trunk/test/Linker/Inputs/subprogram-linkonce-weak.ll (original)
> > +++ llvm/trunk/test/Linker/Inputs/subprogram-linkonce-weak.ll Wed Mar 25 14:57:42 2015
> > @@ -1,7 +1,7 @@
> >  define weak i32 @foo(i32 %a, i32 %b) {
> >  entry:
> > -  %sum = call i32 @fastadd(i32 %a, i32 %b), !dbg !MDLocation(line: 2, scope: !3)
> > -  ret i32 %sum, !dbg !MDLocation(line: 3, scope: !3)
> > +  %sum = call i32 @fastadd(i32 %a, i32 %b), !dbg !MDLocation(line: 52, scope: !3)
> > +  ret i32 %sum, !dbg !MDLocation(line: 53, scope: !3)
> >  }
> >
> >  declare i32 @fastadd(i32, i32)
> > @@ -12,5 +12,5 @@ declare i32 @fastadd(i32, i32)
> >  !llvm.dbg.cu = !{!1}
> >  !1 = !MDCompileUnit(language: DW_LANG_C99, file: !2, subprograms: !{!3}, emissionKind: 2)
> >  !2 = !MDFile(filename: "foo.c", directory: "/path/to/dir")
> > -!3 = !MDSubprogram(file: !2, scope: !2, line: 1, name: "foo", function: i32 (i32, i32)* @foo, type: !4)
> > +!3 = !MDSubprogram(file: !2, scope: !2, line: 51, name: "foo", function: i32 (i32, i32)* @foo, type: !4)
> >  !4 = !MDSubroutineType(types: !{})
> >
> > Modified: llvm/trunk/test/Linker/subprogram-linkonce-weak.ll
> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/subprogram-linkonce-weak.ll?rev=233207&r1=233206&r2=233207&view=diff
> > ==============================================================================
> > --- llvm/trunk/test/Linker/subprogram-linkonce-weak.ll (original)
> > +++ llvm/trunk/test/Linker/subprogram-linkonce-weak.ll Wed Mar 25 14:57:42 2015
> > @@ -66,8 +66,8 @@ entry:
> >  ; LW: ![[FOOINBAR]] = !MDLocation(line: 2, scope: ![[FOOSP]], inlinedAt: ![[BARIA:[0-9]+]])
> >  ; LW: ![[BARIA]] = !MDLocation(line: 12, scope: ![[BARSP]])
> >  ; LW: ![[BARRET]] = !MDLocation(line: 13, scope: ![[BARSP]])
> > -; LW: ![[FOOCALL]] = !MDLocation(line: 2, scope: ![[WEAKFOOSP]])
> > -; LW: ![[FOORET]] = !MDLocation(line: 3, scope: ![[WEAKFOOSP]])
> > +; LW: ![[FOOCALL]] = !MDLocation(line: 52, scope: ![[WEAKFOOSP]])
> > +; LW: ![[FOORET]] = !MDLocation(line: 53, scope: ![[WEAKFOOSP]])
> >
> >  ; Same as above, but reordered.
> >  ; WL: ![[WCU]] = !MDCompileUnit({{.*}} subprograms: ![[WSPs:[0-9]+]]
> > @@ -81,8 +81,8 @@ entry:
> >  ; WL: ![[FOOSP]] = {{.*}}!MDSubprogram(name: "foo",
> >  ; Note, for symmetry, this should be "NOT: function:" and "SAME: ){{$}}".
> >  ; WL-SAME: function: i32 (i32, i32)* @foo
> > -; WL: ![[FOOCALL]] = !MDLocation(line: 2, scope: ![[WEAKFOOSP]])
> > -; WL: ![[FOORET]] = !MDLocation(line: 3, scope: ![[WEAKFOOSP]])
> > +; WL: ![[FOOCALL]] = !MDLocation(line: 52, scope: ![[WEAKFOOSP]])
> > +; WL: ![[FOORET]] = !MDLocation(line: 53, scope: ![[WEAKFOOSP]])
> >  ; WL: ![[FOOINBAR]] = !MDLocation(line: 2, scope: ![[FOOSP]], inlinedAt: ![[BARIA:[0-9]+]])
> >  ; WL: ![[BARIA]] = !MDLocation(line: 12, scope: ![[BARSP]])
> >  ; WL: ![[BARRET]] = !MDLocation(line: 13, scope: ![[BARSP]])
> > @@ -96,15 +96,18 @@ entry:
> >  ; Crasher for llc.
> >  ; REQUIRES: object-emission
> >  ; RUN: %llc_dwarf -filetype=obj -O0 %t1 -o %t1.o
> > -; RUNDISABLED: llvm-dwarfdump %t1.o -debug-dump=info | FileCheck %s -check-prefix=DWLW
> > +; 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
> > -; RUNDISABLED: llvm-dwarfdump %t2.o -debug-dump=info | FileCheck %s -check-prefix=DWWL
> > -; Getting different dwarfdump output on different platforms, so I've
> > -; temporarily disabled the Dwarf FileChecks while leaving in the crash tests.
> > -; I'll keep using PR22792 to track this.
> > +; 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.
> >
> > +; 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:         DW_AT_name {{.*}}foo
> > @@ -117,20 +120,15 @@ entry:
> >  ; DWLW:           DW_AT_abstract_origin
> >  ; DWLW:     DW_TAG_compile_unit
> >  ; DWLW:       DW_AT_name {{.*}}"foo.c"
> > -; DWLW:       DW_TAG_subprogram
> > -; DWLW:         DW_AT_low_pc
> > -; DWLW:         DW_AT_high_pc
> > -; DWLW:         DW_AT_name {{.*}}foo
> > +; DWLW:       DW_AT_low_pc [DW_FORM_addr] ([[FOOLOW:0x[0-9a-f]+]])
> >
> >  ; The DWARF output is already symmetric (just reordered).
> >  ; DWWL:     DW_TAG_compile_unit
> >  ; DWWL:       DW_AT_name {{.*}}"foo.c"
> > -; DWWL:       DW_TAG_subprogram
> > -; DWWL:         DW_AT_low_pc
> > -; DWWL:         DW_AT_high_pc
> > -; DWWL:         DW_AT_name {{.*}}foo
> > +; DWWL:       DW_AT_low_pc [DW_FORM_addr] ([[FOOLOW:0x[0-9a-f]+]])
> >  ; 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:         DW_AT_name {{.*}}foo
> > @@ -141,3 +139,20 @@ entry:
> >  ; DWWL:         DW_AT_name {{.*}}bar
> >  ; 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.
> > +
> > +; DWLW-LABEL: file_names[{{ *}}1]{{.*}} bar.c
> > +; DWLW:       [[BARLOW]]  0 0 1 0 0 is_stmt
> > +; DWLW:       [[BARLOW]]  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:       [[FOOLOW]] 52 0 1 0 0 is_stmt prologue_end
> > +
> > +; DWWL-LABEL: file_names[{{ *}}1]{{.*}} foo.c
> > +; DWWL:       [[FOOLOW]]  0 0 1 0 0 is_stmt
> > +; DWWL:       [[FOOLOW]] 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:       [[BARLOW]]  2 0 1 0 0 is_stmt prologue_end
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >





More information about the llvm-commits mailing list