<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jan 29, 2014 at 2:41 PM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, Jan 29, 2014 at 2:37 PM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>> wrote:<br>

> On Wed, Jan 29, 2014 at 2:32 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
>><br>
>><br>
>><br>
>> On Wed, Jan 29, 2014 at 2:26 PM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> On Wed, Jan 29, 2014 at 2:23 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
>>> ><br>
>>> ><br>
>>> ><br>
>>> > On Wed, Jan 29, 2014 at 2:06 PM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>><br>
>>> > wrote:<br>
>>> >><br>
>>> >> Author: echristo<br>
>>> >> Date: Wed Jan 29 16:06:27 2014<br>
>>> >> New Revision: 200422<br>
>>> >><br>
>>> >> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=200422&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=200422&view=rev</a><br>
>>> >> Log:<br>
>>> >> Turn on CU ranges if we've got multiple compile units in the same<br>
>>> >> module since there's no range guarantee that we could make given<br>
>>> >> output order. This also fixes up the testcases that have multiple<br>
>>> >> CUs to have the correct range offset.<br>
>>> ><br>
>>> ><br>
>>> > What if LTO together a debug and non-debug module together? We'll still<br>
>>> > have<br>
>>> > one CU, but we'll have functions that aren't in that CU - and<br>
>>> > incorrectly<br>
>>> > describe that using an "all text" range?<br>
>>> ><br>
>>><br>
>>> ... Short of saying "always use DW_AT_ranges" I don't have a good<br>
>>> solution for this. I'm somewhat down with that, but...<br>
>><br>
>><br>
>> Perhaps you were addressing this with the "there's no range guarantee that<br>
>> we could make given output order" (I'm not /quite/ sure how to parse that<br>
>> sentence) - but I thought we'd settled on the idea that we could rely on<br>
>> output order and just coalesce functions/ranges that came one after the<br>
>> other. Or did you come up with some cases that breaks down for/that we care<br>
>> about?<br>
>><br>
><br>
> If you have functions that aren't associated with a particular CU<br>
> there's no way of knowing which functions those are. We can only rely<br>
> on the output order to determine whether or not a function is not<br>
> going to appear in debug info output. At least not at the moment. I<br>
> imagine if we were to do so we'd run into the assert at<br>
> DwarfDebug.cpp:1583 right now if we even tried linking the two modules<br>
> together. :\<br>
<br>
</div></div>FWIW we don't seem to. Wacky.<br></blockquote><div><br></div><div>Guess we must be exiting around DwarfDebug.cpp:15671, but not sure.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Anyhow, continuing down the unified range path.<br></blockquote><div><br></div><div>OK - sorry, wasn't clear whether you were pursuing that or whether this patch was an alternative. (given that I don't think this patch should be needed if the unified range stuff works, I assumed this was an alternative)<br>
<br>- Dave</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
-eric<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
>> That way we'd still get high/low whenever it's contiguous, and otherwise<br>
>> we'd use ranges.<br>
>><br>
><br>
> Still don't have this way of doing it in yet, but that's an idea yes.<br>
> I'll see how it works in practice.<br>
><br>
> -eric<br>
><br>
>>><br>
>>><br>
>>> -eric<br>
>>><br>
>>> >><br>
>>> >><br>
>>> >> Modified:<br>
>>> >>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
>>> >>     llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll<br>
>>> >><br>
>>> >> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
>>> >> URL:<br>
>>> >><br>
>>> >> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=200422&r1=200421&r2=200422&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=200422&r1=200421&r2=200422&view=diff</a><br>

>>> >><br>
>>> >><br>
>>> >> ==============================================================================<br>
>>> >> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)<br>
>>> >> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Jan 29<br>
>>> >> 16:06:27<br>
>>> >> 2014<br>
>>> >> @@ -1119,10 +1119,12 @@ void DwarfDebug::endSections() {<br>
>>> >>    }<br>
>>> >><br>
>>> >>    // For now only turn on CU ranges if we've explicitly asked for it,<br>
>>> >> -  // we have -ffunction-sections enabled, or we've emitted a function<br>
>>> >> -  // into a unique section. At this point all sections should be<br>
>>> >> finalized<br>
>>> >> -  // except for dwarf sections.<br>
>>> >> -  HasCURanges = DwarfCURanges || UsedNonDefaultText ||<br>
>>> >> +  // we have -ffunction-sections enabled, we've emitted a function<br>
>>> >> +  // into a unique section, or we're using LTO. If we're using LTO<br>
>>> >> then<br>
>>> >> +  // we can't know that any particular function in the module is<br>
>>> >> correlated<br>
>>> >> +  // to a particular CU and so we need to be conservative. At this<br>
>>> >> point<br>
>>> >> all<br>
>>> >> +  // sections should be finalized except for dwarf sections.<br>
>>> >> +  HasCURanges = DwarfCURanges || UsedNonDefaultText || (CUMap.size() ><br>
>>> >> 1)<br>
>>> >> ||<br>
>>> >>                  TargetMachine::getFunctionSections();<br>
>>> >>  }<br>
>>> >><br>
>>> >><br>
>>> >> Modified:<br>
>>> >> llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll<br>
>>> >> URL:<br>
>>> >><br>
>>> >> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll?rev=200422&r1=200421&r2=200422&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll?rev=200422&r1=200421&r2=200422&view=diff</a><br>

>>> >><br>
>>> >><br>
>>> >> ==============================================================================<br>
>>> >> --- llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll<br>
>>> >> (original)<br>
>>> >> +++ llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll<br>
>>> >> Wed<br>
>>> >> Jan 29 16:06:27 2014<br>
>>> >> @@ -8,11 +8,11 @@<br>
>>> >>  ; CHECK: .debug_info contents:<br>
>>> >>  ; CHECK: DW_TAG_compile_unit<br>
>>> >>  ; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset]   (0x00000000)<br>
>>> >> -; CHECK: DW_AT_low_pc [DW_FORM_addr]       (0x0000000000000000)<br>
>>> >> +; CHECK: DW_AT_ranges [DW_FORM_sec_offset]      (0x00000000)<br>
>>> >><br>
>>> >>  ; CHECK: DW_TAG_compile_unit<br>
>>> >>  ; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset]   (0x0000003c)<br>
>>> >> -; CHECK: DW_AT_low_pc [DW_FORM_addr]       (0x0000000000000000)<br>
>>> >> +; CHECK: DW_AT_ranges [DW_FORM_sec_offset]      (0x00000020)<br>
>>> >><br>
>>> >>  ; CHECK: .debug_line contents:<br>
>>> >>  ; CHECK-NEXT: Line table prologue:<br>
>>> >> @@ -25,12 +25,12 @@<br>
>>> >><br>
>>> >>  ; DWARF3: .debug_info contents:<br>
>>> >>  ; DWARF3: DW_TAG_compile_unit<br>
>>> >> -; DWARF3: DW_AT_stmt_list [DW_FORM_data4]   (0x00000000)<br>
>>> >> -; DWARF3: DW_AT_low_pc [DW_FORM_addr]       (0x0000000000000000)<br>
>>> >> +; DWARF3: DW_AT_stmt_list [DW_FORM_data4]    (0x00000000)<br>
>>> >> +; DWARF3: DW_AT_ranges [DW_FORM_data4]       (0x00000000)<br>
>>> >><br>
>>> >>  ; DWARF3: DW_TAG_compile_unit<br>
>>> >>  ; DWARF3: DW_AT_stmt_list [DW_FORM_data4]   (0x0000003c)<br>
>>> >> -; DWARF3: DW_AT_low_pc [DW_FORM_addr]       (0x0000000000000000)<br>
>>> >> +; DWARF3: DW_AT_ranges [DW_FORM_data4]      (0x00000020)<br>
>>> >><br>
>>> >>  ; DWARF3: .debug_line contents:<br>
>>> >>  ; DWARF3-NEXT: Line table prologue:<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>
>><br>
>><br>
</div></div></blockquote></div><br></div></div>