<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jan 29, 2014 at 2:06 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">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></blockquote><div><br></div><div>What if LTO together a debug and non-debug module together? We'll still have one CU, but we'll have functions that aren't in that CU - and incorrectly describe that using an "all text" range?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<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: <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>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Jan 29 16:06:27 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 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 then<br>
+  // we can't know that any particular function in the module is correlated<br>
+  // to a particular CU and so we need to be conservative. At this point all<br>
+  // sections should be finalized except for dwarf sections.<br>
+  HasCURanges = DwarfCURanges || UsedNonDefaultText || (CUMap.size() > 1) ||<br>
                 TargetMachine::getFunctionSections();<br>
 }<br>
<br>
<br>
Modified: llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll<br>
URL: <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>
--- llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll (original)<br>
+++ llvm/trunk/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll Wed 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>
</blockquote></div><br></div></div>