<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></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 May 11, 2016, at 2:09 PM, Francois Pichet <<a href="mailto:pichet2000@gmail.com" class="">pichet2000@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Good point.</div><div class=""><br class=""></div>Currently yes a DEBUG_VALUE "x", vreg0 will be added in BB2. Now I realize this might be wrong in some (corner?) cases where vreg0 no longer refer to "x"<div class=""><br class=""></div><div class="">My fix would be to propagate the DEBUG_VALUE only if "x" is associated with only a single virtual register.</div><div class="">BTW, my goal is to generally improve DEBUG_VALUE for optimized code, not make it 100% correct.</div></div></div></blockquote><div><br class=""></div>I hold the (perhaps somewhat extreme) position that having debug info the *may* be correct is worse than having no debug info at all, because it means that — in the end — you then cannot trust *anything* reported by the debugger. (There are some debatable corner cases, for example, in contrast to the debugger, the user may know over which path the control flow arrived at the current break point, but these are far in between.)</div><div><br class=""></div><div>That said, I’m very open to improvements to the quality and correctness, so please don’t feel discouraged :-)</div><div><br class=""></div><div>-- adrian<br class=""><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, May 11, 2016 at 4:43 PM, Adrian Prantl <span dir="ltr" class=""><<a href="mailto:aprantl@apple.com" target="_blank" class="">aprantl@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br class="">
> On May 11, 2016, at 1:12 PM, Francois Pichet <<a href="mailto:pichet2000@gmail.com" class="">pichet2000@gmail.com</a>> wrote:<br class="">
><br class="">
</span><span class="">> Hello,<br class="">
><br class="">
> Regarding the problem of debug range for optimized code.<br class="">
> Currently a DEBUG_VALUE will be inserted after the <def>vregX<br class="">
> DEBUG_VALUE are only valid until the end of the current MachineBasicBlock. That's the main problem.<br class="">
> Why not simply iterate over all uses of vregX and insert an DEBUG_VALUE in all the MachineBasicBlocks where vregX is used. (pre regalloc)<br class="">
><br class="">
> I prototyped a small pass to do that and at first it seems to improve .debug_loc range validity and enhance the debugging experience for optimized code.<br class="">
<br class="">
</span>The problem that I see with this approach is that DEBUG_VALUEs are only valid until the next DEBUG_VALUE that describes the same variable. How does your pass handle:<br class="">
<br class="">
BB0:<br class="">
DEBUG_VALUE “x”, vreg0<br class="">
<br class="">
| |<br class="">
| BB1:<br class="">
| DEBUG_VALUE “x”, vreg1<br class="">
| |<br class="">
\_____BB2:<br class="">
| |<br class="">
|____/<br class="">
BB2:<br class="">
vreg0 // still not clobbered here.<br class="">
<br class="">
Does it insert a DEBUG_VALUE “x”, vreg0 into BB2?<br class="">
<span class="HOEnZb"><font color="#888888" class=""><br class="">
-- adrian<br class="">
<br class="">
</font></span></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>