<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 29, 2016 at 10:59 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">+Mehdi<br>
<span class=""><br>
> On 2016-Mar-29, at 22:29, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
><br>
> 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>
<br>
</span>I thought about the algorithm, and then looked for a pass that was<br>
already doing something similar.  ADCE seemed to be good fit since it<br>
also needed three passes through the function.<br>
<br>
I had a look with Mehdi at the pass pipeline, and ADCE is run almost<br>
at the end.  It is run just before exit for -flto=thin, too.<br>
<span class=""><br>
> I'm assuming you want to do this to reduce IR size early on? (pre-(Thin)LTO merge?) </span></blockquote><div><br></div><div>^ ?</div><div> </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><br>
> 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>
<br>
</span>Open to having a separate pass, but since ADCE was such a good fit<br>
(it similarly needed three passes through the IR, which I could just<br>
piggy-back on) and happened to run at the right times I decided not to<br>
think any further.<br></blockquote><div><br></div><div>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><br>- Dave</div><div> </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>
> On Tue, Mar 29, 2016 at 12:34 PM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br>
> During ADCE, track which debug info scopes still have live references<br>
> from the code, and delete debug info intrinsics for the dead ones.<br>
><br>
> These intrinsics describe the locations of variables (in registers or<br>
> stack slots).  If there's no code left corresponding to a variable's<br>
> scope, then there's no way to reference the variable in the debugger and<br>
> it doesn't matter what its value is.<br>
><br>
> I add a DEBUG printout when the described location in an SSA register,<br>
> in case it helps some trying to track down why locations get lost.<br>
> However, we still delete these; the root problem is that the scope<br>
> itself isn't attached to any real code.<br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div></div>