<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 21, 2014 at 3:38 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank" class="cremed">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">================<br>
Comment at: lib/Transforms/Scalar/SampleProfile.cpp:662<br>
@@ +661,3 @@<br>
+    // leading back to \p F.<br>
+    for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {<br>
+      BasicBlock *B = I;<br>
----------------<br>
Please use range-based-for loops.<br>
<br></blockquote><div><br></div><div>The file already uses iterator-based loops. OK if I update all the loops in a subsequent patch?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
================<br>
Comment at: lib/Transforms/Scalar/SampleProfile.cpp:671<br>
@@ +670,3 @@<br>
+        if (Subprogram.describes(&F))<br>
+          return Subprogram.getLineNumber();<br>
+      }<br>
----------------<br>
If you find an instruction with DebugLoc, you don't need to keep searching - no matter what its subprogram node is.<br></blockquote><div><br></div><div>Ah, so you want a failure if Subprogram.describes(&F) is false. Got it.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Here's the invariant that I believe now holds:<br>
If a function has debug info, the scope chain of all instructions in that function will lead to the function and nothing else.<br>
<br>
So once you find one instruction with a debug loc, you don't need to examine any others - if it leads to this function, you're done, if it doesn't then this function doesn't have debug info.<br></blockquote><div><br></div><div>Done.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
================<br>
Comment at: test/Transforms/SampleProfile/loc-tracking-only.ll:3<br>
@@ +2,3 @@<br>
+<br>
+; This test is identical to calls.ll but it is missing the <a href="http://llvm.dbg.cu" target="_blank" class="cremed">llvm.dbg.cu</a><br>
+; annotation. This emulates the effect of the user having only used<br>
----------------<br>
Worth updating calls.ll itself instead of adding a new test? If you don't depend on the <a href="http://llvm.dbg.cu" target="_blank" class="cremed">llvm.dbg.cu</a> at all, it doesn't seem worthwhile to have two different tests, one with it and one without it.<br></blockquote><div><br></div><div>Ah, yes. Perhaps that's easiest. The other tests already cover the case where <a href="http://llvm.dbg.cu" target="_blank" class="cremed">llvm.dbg.cu</a> is present.</div><div><br></div><div><br></div><div>Thanks. Diego.</div></div></div></div>