<div dir="ltr">Given what we do now, we would walk the uses the same number of times. However:<div><br><div>1) We currently do not run an instruction visitor in the very beginning of the pass (before instrumenting memory acceses). So we would either need to walk instructions or possibly move FunctionStackPoisoner to run in the very beginning (not sure if that is possible).</div><div>2) When we are at the point where we look only at provably safe memory accesses, we could just mark allocas as interesting as we are walking the memory operations and deciding which ones to instrument. There would be no need to look at uses twice in that case. (I guess, there is no need for that now either other than I'd prefer to just call the existing isAllocaPromotable rather than migrating that functionality into the ASan pass.) </div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 26, 2015 at 3:44 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><span class=""><br><div class="gmail_quote">On Thu, Mar 26, 2015 at 3:34 PM, Kostya Serebryany <span dir="ltr"><<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>> > Each walk of the use list of the alloca is relatively expensive -- it is a linked list and cache hostile.<br>
<br>
><br>
<br>
<br>
</span>But won't we need it anyway regardless of caching-cs-precomputing?</blockquote></div><br></span>Yes, what I'm saying is that reducing the number of times you walk the use list is relevant. It's a locality optimization. Where possible, it is good to try to do as much work as possible during a single use-list traversal rather than to traverse every alloca instructions' use list multiple times for the multiple things you might need to do.</div></div>
</blockquote></div><br></div>