<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 Mar 30, 2016, at 9:18 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=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Mar 29, 2016 at 10:59 PM, Duncan P. N. Exon Smith <span dir="ltr" class=""><<a href="mailto:dexonsmith@apple.com" target="_blank" class="">dexonsmith@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">+Mehdi<br class="">
<span class=""><br class="">
> On 2016-Mar-29, at 22:29, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:<br class="">
><br class="">
> Does it make sense to do this in ADCE and ADCE only? Lots of code can remove instructions & could be the place where a scope ceases to exist, so it seems strange to make this change only here, doesn't it?<br class="">
<br class="">
</span>I thought about the algorithm, and then looked for a pass that was<br class="">
already doing something similar.  ADCE seemed to be good fit since it<br class="">
also needed three passes through the function.<br class="">
<br class="">
I had a look with Mehdi at the pass pipeline, and ADCE is run almost<br class="">
at the end.  It is run just before exit for -flto=thin, too.<br class="">
<span class=""><br class="">
> I'm assuming you want to do this to reduce IR size early on? (pre-(Thin)LTO merge?) </span></blockquote><div class=""><br class=""></div><div class="">^ ?</div></div></div></div></div></blockquote><div><br class=""></div><div>This is the motivation for this change (trying to emit less metadata in the end), but it is valuable in general: smaller basic blocks for all the optimization that will follow, less memory, etc.</div><div>This seems a good motivation to run ADCE in general as well.</div><div><br class=""></div><div>-- </div><div>Mehdi</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Maybe as a separate pass?<br class=""><br class="">
> If it's just to reduce debug info output - maybe better to just delay until IR generation? (perhaps we already do this, I forget?)<br class="">
<br class="">
</span>Open to having a separate pass, but since ADCE was such a good fit<br class="">
(it similarly needed three passes through the IR, which I could just<br class="">
piggy-back on) and happened to run at the right times I decided not to<br class="">
think any further.<br class=""></blockquote><div class=""><br class=""></div><div class="">Hmm, rightio - I don't know too much about pass design (when we try to make them independent, when we don't). So I'll leave it to you folks & others to chime in if there are relevant guiding principles that should be applied differently here.<br class=""><br class="">- Dave</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br class="">
> On Tue, Mar 29, 2016 at 12:34 PM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com" class="">dexonsmith@apple.com</a>> wrote:<br class="">
> During ADCE, track which debug info scopes still have live references<br class="">
> from the code, and delete debug info intrinsics for the dead ones.<br class="">
><br class="">
> These intrinsics describe the locations of variables (in registers or<br class="">
> stack slots).  If there's no code left corresponding to a variable's<br class="">
> scope, then there's no way to reference the variable in the debugger and<br class="">
> it doesn't matter what its value is.<br class="">
><br class="">
> I add a DEBUG printout when the described location in an SSA register,<br class="">
> in case it helps some trying to track down why locations get lost.<br class="">
> However, we still delete these; the root problem is that the scope<br class="">
> itself isn't attached to any real code.<br class="">
><br class="">
><br class="">
<br class="">
</div></div></blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></body></html>