<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 8, 2017, at 9:44 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Wed, Feb 8, 2017 at 9:36 AM Adrian Prantl <<a href="mailto:aprantl@apple.com" class="">aprantl@apple.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="gmail_msg">
> On Feb 8, 2017, at 9:25 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="gmail_msg" target="_blank">dblaikie@gmail.com</a>> wrote:<br class="gmail_msg">
><br class="gmail_msg">
> So Reid came across a case where the current strategy (dropping locations when they move across basic blocks) proves to be at odds with another precept we have: inlinable calls must have locations, so that if/when they are inlined the location can be accurately described (due to the nature of our IR representation of inlining, a location must be given for the call site so that the DIEs for the inlined subroutine can be described)<br class="gmail_msg">
><br class="gmail_msg">
> Any ideas on how we should approach this?<br class="gmail_msg">
><br class="gmail_msg">
> We could have a bit in DebugLoc (or other choice of representation) for the non-line location. For the line table this would work the same as absent DebugLoc - for calls it would cause call_file/line/discriminator (do we have a call_discriminator? We probably should, don't know if we do) to be omitted which is something the LLVM IR representation currently can't express.<br class="gmail_msg">
<br class="gmail_msg">
Even if the function calls are not inlined it could be preferable to keep a debug location. It's a very odd debugging experience to be stopped at a breakpoint and then do "up" (or just "bt") to look at the parent frame and not have a location for the call in the parent frame.<br class="gmail_msg"></blockquote><div class=""><br class=""></div><div class="">Usually what will happen is it will have a location, it'll be the flow-on from the previous location (ie: we won't emit any line entry for the call, so it naturally ends up at the line of whatever instruction came before).</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Is the stripping in this case motivated by correctness for profiling or just to smooth the line table to improve the stepping experience?<br class="gmail_msg"></blockquote><div class=""><br class=""></div><div class="">Mostly it seems the people pushing/contributing patches are motivated by profile correctness, as far as I understand (with the line table/debugging behavior 'improvement' being a nod to "there's at least an argument to be made that this could be justified by debuggability too"). At least that's the impression I get. I may've misunderstood.</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If its about correctness for profiling, we should consider having a separate profiling location or a skip-for-profiling bit as David suggests, that honored when the CU has the new tune-for-profiling flag set.<br class="gmail_msg"></blockquote><div class=""><br class=""></div><div class="">I think that might be a bit too much, in my mind, for the tune-for-profiling flag. Adding things to make the profile more accurate seems good - removing things and 'hurting' debuggability because you opted for profiling seems like a different and more difficult-to-tolerate situation.</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If it is about a better stepping experience, we just shouldn't do this for call sites.<br class="gmail_msg"></blockquote><div class=""><br class=""></div><div class="">Why? A call could produce weird stepping behavior as much as a non-call instruction, and could be similarly mis-attributed. CSE could hoist two distinct calls to pure functions into a common block and we'd pick one location - the stack trace and location would be confusing to the debugger user (it could end up indicating that the if branch was taken when it was really the else branch, being the canonical example)<br class=""><br class="">Calls don't seem fundamentally special here - except due to limitations of the IR representation.</div></div></div></div></blockquote><div><br class=""></div><div>The CSE example is a good one, though I *think* in this case we will end up calling getMergedDebugLocation() which will return a line 0 location. Which brings me to the next idea: Couldn't we just assign a line 0 location instead of removing the DebugLoc and everybody would be happy?</div><div>Or should we treat moving an instruction to a different BB different from CSE?</div><div><br class=""></div><div>-- adrian</div></div></body></html>