<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 25, 2015 at 2:41 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On 2015-Mar-25, at 14:20, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> On Wed, Mar 25, 2015 at 2:14 PM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br>
><br>
> > On 2015-Mar-25, at 14:11, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
> ><br>
> ><br>
> ><br>
> > On Wed, Mar 25, 2015 at 2:08 PM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br>
> ><br>
> > > On 2015-Mar-25, at 13:06, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
> > ><br>
> > ><br>
> > ><br>
> > > On Wed, Mar 25, 2015 at 12:57 PM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br>
> > > Author: dexonsmith<br>
> > > Date: Wed Mar 25 14:57:42 2015<br>
> > > New Revision: 233207<br>
> > ><br>
> > > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=233207&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=233207&view=rev</a><br>
> > > Log:<br>
> > > Linker: Rewrite dwarfdump checks from r233164<br>
> > ><br>
> > > Rewrite the checks from r233164 that I temporarily disabled in r233165.<br>
> > ><br>
> > > It turns out that the line-tables only debug info we emit from `llc` is<br>
> > > (intentionally) different on Linux than on Darwin.<br>
> > ><br>
> > > Does this need to test gmlt rather than normal -g?<br>
> ><br>
> > I suppose not, but it's easier to hand-write line-tables only debug info,<br>
><br>
> Really?! I had assumed the backend required more fidelity or details or<br>
> something when not in `-gmlt` mode. I'll play around.<br>
><br>
> Nah - in fact there was no backend option for gmlt until Eric added it to avoid emitting aranges, I think? Prior to that it was purely a frontend feature that just skipped creating the metadata for types, parameters, variables, etc.<br>
><br>
> Then I used the flag Eric added to make the gmlt even smarter in the backend (by omitting unused subprograms, omitting unnecessary attributes, etc).<br>
<br>
</span>Awesome. Hopefully finally finished with this blasted testcase with<br>
r233221, which tests the debug info directly rather than relying on<br>
links to the line table. I left in checks of the line table itself<br>
since we care about that as well, but they're no longer codependent.<br></blockquote><div><br>Shiny - I haven't looked at the test case in any detail, but glad to help get it sorted. Sounds like you've got it all squared away.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
><br>
><br>
> ><br>
> > 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.<br>
> ><br>
> > and that should be sufficient for checking if the correct subprogram is<br>
> > around.<br>
> ><br>
> > ><br>
> > > 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?)<br>
> ><br>
> > I want to test:<br>
> ><br>
> > 1. That the merged IR zeros out Functions (although I imagine this could<br>
> > change eventually).<br>
> > 2. That `llc` doesn't crash.<br>
> > 3. That in the output DWARF, the debug info from the `weak` version of<br>
> > `@foo` is what's actually used (not the debug info from the discarded<br>
> > `linkonce` version of `@foo`).<br>
> ><br>
> > All these things should be true for both Linux and Darwin (and any other<br>
> > platform we support, I think).<br>
> ><br>
> > ><br>
> > > r218129 started<br>
> > > skipping emission of subprograms with no inlined subroutines, and<br>
> > > r218702 was a spiritual revert of that behaviour for Darwin.<br>
> > ><br>
> > > I think we can still test this in a platform-neutral way.<br>
> > ><br>
> > > - Stop checking for the possibly missing `DW_TAG_subprogram` defining<br>
> > > the debug info for the real version of `@foo`.<br>
> > > - Start checking the line tables, ensuring that the right debug info<br>
> > > was used to generate them (grabbing `DW_AT_low_pc` from the compile<br>
> > > unit).<br>
> > > - I changed up the line numbers used in the "weak" version so it's<br>
> > > easier to follow.<br>
> > ><br>
> > > This should hopefully finish off PR22792.<br>
> > ><br>
> > > Modified:<br>
> > > llvm/trunk/test/Linker/Inputs/subprogram-linkonce-weak.ll<br>
> > > llvm/trunk/test/Linker/subprogram-linkonce-weak.ll<br>
> > ><br>
> > > Modified: llvm/trunk/test/Linker/Inputs/subprogram-linkonce-weak.ll<br>
> > > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/Inputs/subprogram-linkonce-weak.ll?rev=233207&r1=233206&r2=233207&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/Inputs/subprogram-linkonce-weak.ll?rev=233207&r1=233206&r2=233207&view=diff</a><br>
> > > ==============================================================================<br>
> > > --- llvm/trunk/test/Linker/Inputs/subprogram-linkonce-weak.ll (original)<br>
> > > +++ llvm/trunk/test/Linker/Inputs/subprogram-linkonce-weak.ll Wed Mar 25 14:57:42 2015<br>
> > > @@ -1,7 +1,7 @@<br>
> > > define weak i32 @foo(i32 %a, i32 %b) {<br>
> > > entry:<br>
> > > - %sum = call i32 @fastadd(i32 %a, i32 %b), !dbg !MDLocation(line: 2, scope: !3)<br>
> > > - ret i32 %sum, !dbg !MDLocation(line: 3, scope: !3)<br>
> > > + %sum = call i32 @fastadd(i32 %a, i32 %b), !dbg !MDLocation(line: 52, scope: !3)<br>
> > > + ret i32 %sum, !dbg !MDLocation(line: 53, scope: !3)<br>
> > > }<br>
> > ><br>
> > > declare i32 @fastadd(i32, i32)<br>
> > > @@ -12,5 +12,5 @@ declare i32 @fastadd(i32, i32)<br>
> > > !<a href="http://llvm.dbg.cu" target="_blank">llvm.dbg.cu</a> = !{!1}<br>
> > > !1 = !MDCompileUnit(language: DW_LANG_C99, file: !2, subprograms: !{!3}, emissionKind: 2)<br>
> > > !2 = !MDFile(filename: "foo.c", directory: "/path/to/dir")<br>
> > > -!3 = !MDSubprogram(file: !2, scope: !2, line: 1, name: "foo", function: i32 (i32, i32)* @foo, type: !4)<br>
> > > +!3 = !MDSubprogram(file: !2, scope: !2, line: 51, name: "foo", function: i32 (i32, i32)* @foo, type: !4)<br>
> > > !4 = !MDSubroutineType(types: !{})<br>
> > ><br>
> > > Modified: llvm/trunk/test/Linker/subprogram-linkonce-weak.ll<br>
> > > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/subprogram-linkonce-weak.ll?rev=233207&r1=233206&r2=233207&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/subprogram-linkonce-weak.ll?rev=233207&r1=233206&r2=233207&view=diff</a><br>
> > > ==============================================================================<br>
> > > --- llvm/trunk/test/Linker/subprogram-linkonce-weak.ll (original)<br>
> > > +++ llvm/trunk/test/Linker/subprogram-linkonce-weak.ll Wed Mar 25 14:57:42 2015<br>
> > > @@ -66,8 +66,8 @@ entry:<br>
> > > ; LW: ![[FOOINBAR]] = !MDLocation(line: 2, scope: ![[FOOSP]], inlinedAt: ![[BARIA:[0-9]+]])<br>
> > > ; LW: ![[BARIA]] = !MDLocation(line: 12, scope: ![[BARSP]])<br>
> > > ; LW: ![[BARRET]] = !MDLocation(line: 13, scope: ![[BARSP]])<br>
> > > -; LW: ![[FOOCALL]] = !MDLocation(line: 2, scope: ![[WEAKFOOSP]])<br>
> > > -; LW: ![[FOORET]] = !MDLocation(line: 3, scope: ![[WEAKFOOSP]])<br>
> > > +; LW: ![[FOOCALL]] = !MDLocation(line: 52, scope: ![[WEAKFOOSP]])<br>
> > > +; LW: ![[FOORET]] = !MDLocation(line: 53, scope: ![[WEAKFOOSP]])<br>
> > ><br>
> > > ; Same as above, but reordered.<br>
> > > ; WL: ![[WCU]] = !MDCompileUnit({{.*}} subprograms: ![[WSPs:[0-9]+]]<br>
> > > @@ -81,8 +81,8 @@ entry:<br>
> > > ; WL: ![[FOOSP]] = {{.*}}!MDSubprogram(name: "foo",<br>
> > > ; Note, for symmetry, this should be "NOT: function:" and "SAME: ){{$}}".<br>
> > > ; WL-SAME: function: i32 (i32, i32)* @foo<br>
> > > -; WL: ![[FOOCALL]] = !MDLocation(line: 2, scope: ![[WEAKFOOSP]])<br>
> > > -; WL: ![[FOORET]] = !MDLocation(line: 3, scope: ![[WEAKFOOSP]])<br>
> > > +; WL: ![[FOOCALL]] = !MDLocation(line: 52, scope: ![[WEAKFOOSP]])<br>
> > > +; WL: ![[FOORET]] = !MDLocation(line: 53, scope: ![[WEAKFOOSP]])<br>
> > > ; WL: ![[FOOINBAR]] = !MDLocation(line: 2, scope: ![[FOOSP]], inlinedAt: ![[BARIA:[0-9]+]])<br>
> > > ; WL: ![[BARIA]] = !MDLocation(line: 12, scope: ![[BARSP]])<br>
> > > ; WL: ![[BARRET]] = !MDLocation(line: 13, scope: ![[BARSP]])<br>
> > > @@ -96,15 +96,18 @@ entry:<br>
> > > ; Crasher for llc.<br>
> > > ; REQUIRES: object-emission<br>
> > > ; RUN: %llc_dwarf -filetype=obj -O0 %t1 -o %t1.o<br>
> > > -; RUNDISABLED: llvm-dwarfdump %t1.o -debug-dump=info | FileCheck %s -check-prefix=DWLW<br>
> > > +; RUN: llvm-dwarfdump %t1.o -debug-dump=all | FileCheck %s -check-prefix=DWLW -check-prefix=DW<br>
> > > ; RUN: %llc_dwarf -filetype=obj -O0 %t2 -o %t2.o<br>
> > > -; RUNDISABLED: llvm-dwarfdump %t2.o -debug-dump=info | FileCheck %s -check-prefix=DWWL<br>
> > > -; Getting different dwarfdump output on different platforms, so I've<br>
> > > -; temporarily disabled the Dwarf FileChecks while leaving in the crash tests.<br>
> > > -; I'll keep using PR22792 to track this.<br>
> > > +; RUN: llvm-dwarfdump %t2.o -debug-dump=all | FileCheck %s -check-prefix=DWWL -check-prefix=DW<br>
> > > +; Don't check for the DW_TAG_subprogram for the weak version of @foo. It has<br>
> > > +; no inlined subroutines, so with -gmlt may not exist (debuggers can find the<br>
> > > +; aranges in the compile unit and look in the line table directly). See the<br>
> > > +; checks against the line table that follow.<br>
> > ><br>
> > > +; DW-LABEL: .debug_info contents:<br>
> > > ; DWLW: DW_TAG_compile_unit<br>
> > > ; DWLW: DW_AT_name {{.*}}"bar.c"<br>
> > > +; DWLW: DW_AT_low_pc [DW_FORM_addr] ([[BARLOW:0x[0-9a-f]+]])<br>
> > > ; DWLW: DW_TAG_subprogram<br>
> > > ; DWLW-NOT: DW_AT_{{[lowhigh]*}}_pc<br>
> > > ; DWLW: DW_AT_name {{.*}}foo<br>
> > > @@ -117,20 +120,15 @@ entry:<br>
> > > ; DWLW: DW_AT_abstract_origin<br>
> > > ; DWLW: DW_TAG_compile_unit<br>
> > > ; DWLW: DW_AT_name {{.*}}"foo.c"<br>
> > > -; DWLW: DW_TAG_subprogram<br>
> > > -; DWLW: DW_AT_low_pc<br>
> > > -; DWLW: DW_AT_high_pc<br>
> > > -; DWLW: DW_AT_name {{.*}}foo<br>
> > > +; DWLW: DW_AT_low_pc [DW_FORM_addr] ([[FOOLOW:0x[0-9a-f]+]])<br>
> > ><br>
> > > ; The DWARF output is already symmetric (just reordered).<br>
> > > ; DWWL: DW_TAG_compile_unit<br>
> > > ; DWWL: DW_AT_name {{.*}}"foo.c"<br>
> > > -; DWWL: DW_TAG_subprogram<br>
> > > -; DWWL: DW_AT_low_pc<br>
> > > -; DWWL: DW_AT_high_pc<br>
> > > -; DWWL: DW_AT_name {{.*}}foo<br>
> > > +; DWWL: DW_AT_low_pc [DW_FORM_addr] ([[FOOLOW:0x[0-9a-f]+]])<br>
> > > ; DWWL: DW_TAG_compile_unit<br>
> > > ; DWWL: DW_AT_name {{.*}}"bar.c"<br>
> > > +; DWWL: DW_AT_low_pc [DW_FORM_addr] ([[BARLOW:0x[0-9a-f]+]])<br>
> > > ; DWWL: DW_TAG_subprogram<br>
> > > ; DWWL-NOT: DW_AT_{{[lowhigh]*}}_pc<br>
> > > ; DWWL: DW_AT_name {{.*}}foo<br>
> > > @@ -141,3 +139,20 @@ entry:<br>
> > > ; DWWL: DW_AT_name {{.*}}bar<br>
> > > ; DWWL: DW_TAG_inlined_subroutine<br>
> > > ; DWWL: DW_AT_abstract_origin<br>
> > > +<br>
> > > +; DW-LABEL: .debug_line contents:<br>
> > > +; Check that the low_pc entries from above hit the right files.<br>
> > > +<br>
> > > +; DWLW-LABEL: file_names[{{ *}}1]{{.*}} bar.c<br>
> > > +; DWLW: [[BARLOW]] 0 0 1 0 0 is_stmt<br>
> > > +; DWLW: [[BARLOW]] 2 0 1 0 0 is_stmt prologue_end<br>
> > > +; DWLW-LABEL: file_names[{{ *}}1]{{.*}} foo.c<br>
> > > +; DWLW: [[FOOLOW]] 0 0 1 0 0 is_stmt<br>
> > > +; DWLW: [[FOOLOW]] 52 0 1 0 0 is_stmt prologue_end<br>
> > > +<br>
> > > +; DWWL-LABEL: file_names[{{ *}}1]{{.*}} foo.c<br>
> > > +; DWWL: [[FOOLOW]] 0 0 1 0 0 is_stmt<br>
> > > +; DWWL: [[FOOLOW]] 52 0 1 0 0 is_stmt prologue_end<br>
> > > +; DWWL-LABEL: file_names[{{ *}}1]{{.*}} bar.c<br>
> > > +; DWWL: [[BARLOW]] 0 0 1 0 0 is_stmt<br>
> > > +; DWWL: [[BARLOW]] 2 0 1 0 0 is_stmt prologue_end<br>
> > ><br>
> > ><br>
> > > _______________________________________________<br>
> > > llvm-commits mailing list<br>
> > > <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> > > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
> > ><br>
<br>
</div></div></blockquote></div><br></div></div>