<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 18, 2015 at 11:22 AM, Daniel Sanders <span dir="ltr"><<a href="mailto:Daniel.Sanders@imgtec.com" target="_blank">Daniel.Sanders@imgtec.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi David,<br>
<br>
Is it essential that this test has six calls to f1() </blockquote><div><br>Nope<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">or would it be just as good with six calls to six different functions?<br></blockquote><div><br></div><div>Sort of.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The reason I ask is that Mips is failing this test because the address of the function is calculated six times and all six use the line info for the first call. As a result, there are some additional .loc's and it fails some of the 'CHECK-NOT: .loc' directives. The easiest way to fix this seems to be to call six different functions but I thought I ought to check that this didn't go against the intent of the test.<br></blockquote><div><br>That seems like it'll produce a bad experience for the user (stepping through the function they'll jump back & forth to the start all the time).<br><br>If you are going to update/modify the test, it's probably worth a comment explaining that you're working around a MIPS bug that ought to be fixed at some point.<br><br>- David<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
________________________________________<br>
From: <a href="mailto:llvm-commits-bounces@cs.uiuc.edu">llvm-commits-bounces@cs.uiuc.edu</a> [<a href="mailto:llvm-commits-bounces@cs.uiuc.edu">llvm-commits-bounces@cs.uiuc.edu</a>] on behalf of David Blaikie [<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>]<br>
Sent: 30 December 2014 22:47<br>
To: <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
Subject: [llvm] r225011 - DebugInfo: Omit is_stmt from line table entries on    the same line.<br>
<div class="HOEnZb"><div class="h5"><br>
Author: dblaikie<br>
Date: Tue Dec 30 16:47:13 2014<br>
New Revision: 225011<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=225011&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=225011&view=rev</a><br>
Log:<br>
DebugInfo: Omit is_stmt from line table entries on the same line.<br>
<br>
GCC does this for non-zero discriminators and since GCC doesn't produce<br>
column info, that was the only place it comes up there. For LLVM, since<br>
we can emit discriminators and/or column info, it makes more sense to<br>
invert the condition and just test for changes in line number.<br>
<br>
This should resolve at least some of the GDB 7.5 test suite failures<br>
created by recent Clang changes that increase the location fidelity<br>
(which, since Clang defaults to including column info on Linux by<br>
default created a bunch of cases that confused GDB).<br>
<br>
In theory we could do this better/differently by grouping actual source<br>
statements together in a similar manner to the way lexical scopes are<br>
handled but given that GDB isn't really in a position to consume that (&<br>
users are probably somewhat used to different lines being different<br>
'statements') this seems the safest and cheapest change. (I'm concerned<br>
that doing this 'right' would bloat the debugloc data even further -<br>
something Duncan's working hard to address)<br>
<br>
Added:<br>
    llvm/trunk/test/DebugInfo/multiline.ll<br>
Modified:<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
    llvm/trunk/lib/MC/MCAsmStreamer.cpp<br>
    llvm/trunk/test/DebugInfo/X86/discriminator.ll<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=225011&r1=225010&r2=225011&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=225011&r1=225010&r2=225011&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Dec 30 16:47:13 2014<br>
@@ -1026,8 +1026,10 @@ void DwarfDebug::beginInstruction(const<br>
       if (DL == PrologEndLoc) {<br>
         Flags |= DWARF2_FLAG_PROLOGUE_END;<br>
         PrologEndLoc = DebugLoc();<br>
+        Flags |= DWARF2_FLAG_IS_STMT;<br>
       }<br>
-      if (PrologEndLoc.isUnknown())<br>
+      if (DL.getLine() !=<br>
+          Asm->OutStreamer.getContext().getCurrentDwarfLoc().getLine())<br>
         Flags |= DWARF2_FLAG_IS_STMT;<br>
<br>
       if (!DL.isUnknown()) {<br>
<br>
Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=225011&r1=225010&r2=225011&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=225011&r1=225010&r2=225011&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)<br>
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Tue Dec 30 16:47:13 2014<br>
@@ -872,8 +872,6 @@ void MCAsmStreamer::EmitDwarfLocDirectiv<br>
                                           unsigned Isa,<br>
                                           unsigned Discriminator,<br>
                                           StringRef FileName) {<br>
-  this->MCStreamer::EmitDwarfLocDirective(FileNo, Line, Column, Flags,<br>
-                                          Isa, Discriminator, FileName);<br>
   OS << "\t.loc\t" << FileNo << " " << Line << " " << Column;<br>
   if (Flags & DWARF2_FLAG_BASIC_BLOCK)<br>
     OS << " basic_block";<br>
@@ -903,6 +901,8 @@ void MCAsmStreamer::EmitDwarfLocDirectiv<br>
        << Line << ':' << Column;<br>
   }<br>
   EmitEOL();<br>
+  this->MCStreamer::EmitDwarfLocDirective(FileNo, Line, Column, Flags,<br>
+                                          Isa, Discriminator, FileName);<br>
 }<br>
<br>
 MCSymbol *MCAsmStreamer::getDwarfLineTableSymbol(unsigned CUID) {<br>
<br>
Modified: llvm/trunk/test/DebugInfo/X86/discriminator.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/discriminator.ll?rev=225011&r1=225010&r2=225011&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/discriminator.ll?rev=225011&r1=225010&r2=225011&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/X86/discriminator.ll (original)<br>
+++ llvm/trunk/test/DebugInfo/X86/discriminator.ll Tue Dec 30 16:47:13 2014<br>
@@ -60,4 +60,4 @@ attributes #0 = { nounwind uwtable "less<br>
<br>
 ; CHECK: Address            Line   Column File   ISA Discriminator Flags<br>
 ; CHECK: ------------------ ------ ------ ------ --- ------------- -------------<br>
-; CHECK: 0x0000000000000011      2      0      1   0            42  is_stmt<br>
+; CHECK: 0x0000000000000011      2      0      1   0            42 {{$}}<br>
<br>
Added: llvm/trunk/test/DebugInfo/multiline.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/multiline.ll?rev=225011&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/multiline.ll?rev=225011&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/DebugInfo/multiline.ll (added)<br>
+++ llvm/trunk/test/DebugInfo/multiline.ll Tue Dec 30 16:47:13 2014<br>
@@ -0,0 +1,81 @@<br>
+; RUN: llc -filetype=asm -O0 < %s | FileCheck %s<br>
+; RUN: llc -filetype=obj -O0 < %s | llvm-dwarfdump -debug-dump=line - | FileCheck %s --check-prefix=INT<br>
+<br>
+; Check that the assembly output properly handles is_stmt changes. And since<br>
+; we're testing anyway, check the integrated assembler too.<br>
+<br>
+; Generated with clang from multiline.c:<br>
+; void f1();<br>
+; void f2() {<br>
+;   f1(); f1(); f1();<br>
+;   f1(); f1(); f1();<br>
+; }<br>
+<br>
+<br>
+; CHECK: .loc  1 2 0 #<br>
+; CHECK-NOT: .loc<br>
+; CHECK: .loc  1 3 3 prologue_end #<br>
+; CHECK-NOT: .loc<br>
+; CHECK: .loc  1 3 9 is_stmt 0 #<br>
+; CHECK-NOT: .loc<br>
+; CHECK: .loc  1 3 15 #<br>
+; CHECK-NOT: .loc<br>
+; CHECK: .loc  1 4 3 is_stmt 1 #<br>
+; CHECK-NOT: .loc<br>
+; CHECK: .loc  1 4 9 is_stmt 0 #<br>
+; CHECK-NOT: .loc<br>
+; CHECK: .loc  1 4 15 #<br>
+; CHECK-NOT: .loc<br>
+; CHECK: .loc  1 5 1 is_stmt 1 #<br>
+<br>
+; INT: {{^}}Address<br>
+; INT: -----<br>
+; INT-NEXT: 2 0 1 0 0 is_stmt{{$}}<br>
+; INT-NEXT: 3 3 1 0 0 is_stmt prologue_end{{$}}<br>
+; INT-NEXT: 3 9 1 0 0 {{$}}<br>
+; INT-NEXT: 3 15 1 0 0 {{$}}<br>
+; INT-NEXT: 4 3 1 0 0 is_stmt{{$}}<br>
+; INT-NEXT: 4 9 1 0 0 {{$}}<br>
+; INT-NEXT: 4 15 1 0 0 {{$}}<br>
+; INT-NEXT: 5 1 1 0 0 is_stmt{{$}}<br>
+<br>
+<br>
+; Function Attrs: nounwind uwtable<br>
+define void @f2() #0 {<br>
+entry:<br>
+  call void (...)* @f1(), !dbg !11<br>
+  call void (...)* @f1(), !dbg !12<br>
+  call void (...)* @f1(), !dbg !13<br>
+  call void (...)* @f1(), !dbg !14<br>
+  call void (...)* @f1(), !dbg !15<br>
+  call void (...)* @f1(), !dbg !16<br>
+  ret void, !dbg !17<br>
+}<br>
+<br>
+declare void @f1(...) #1<br>
+<br>
+attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }<br>
+attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }<br>
+<br>
+!<a href="http://llvm.dbg.cu" target="_blank">llvm.dbg.cu</a> = !{!0}<br>
+!llvm.module.flags = !{!8, !9}<br>
+!llvm.ident = !{!10}<br>
+<br>
+!0 = !{!"0x11\0012\00clang version 3.6.0 (trunk 225000) (llvm/trunk 224999)\000\00\000\00\001", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [/tmp/dbginfo/multiline.c] [DW_LANG_C99]<br>
+!1 = !{!"multiline.c", !"/tmp/dbginfo"}<br>
+!2 = !{}<br>
+!3 = !{!4}<br>
+!4 = !{!"0x2e\00f2\00f2\00\002\000\001\000\000\000\000\002", !1, !5, !6, null, void ()* @f2, null, null, !2} ; [ DW_TAG_subprogram ] [line 2] [def] [f2]<br>
+!5 = !{!"0x29", !1}                               ; [ DW_TAG_file_type ] [/tmp/dbginfo/multiline.c]<br>
+!6 = !{!"0x15\00\000\000\000\000\000\000", null, null, null, !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]<br>
+!7 = !{null}<br>
+!8 = !{i32 2, !"Dwarf Version", i32 4}<br>
+!9 = !{i32 2, !"Debug Info Version", i32 2}<br>
+!10 = !{!"clang version 3.6.0 (trunk 225000) (llvm/trunk 224999)"}<br>
+!11 = !{i32 3, i32 3, !4, null}<br>
+!12 = !{i32 3, i32 9, !4, null}<br>
+!13 = !{i32 3, i32 15, !4, null}<br>
+!14 = !{i32 4, i32 3, !4, null}<br>
+!15 = !{i32 4, i32 9, !4, null}<br>
+!16 = !{i32 4, i32 15, !4, null}<br>
+!17 = !{i32 5, i32 1, !4, null}<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>
</div></div></blockquote></div><br></div></div>