<div dir="ltr">This will not work if it's memory.<div><br><div>Yu'd need to use MemorySSA or MemoryDependenceAnalysis to get the last instruction to modify a block of memory.</div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 20, 2018 at 10:24 AM, Dávid Bolvanský via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</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>Maybe nicer..</div><div>auto i = Src->uses().begin();</div><div>std::advance(i, Src->getNumUses() - 1);</div><div>i->getUser()->dump();</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2018-04-20 19:19 GMT+02:00 Dávid Bolvanský <span dir="ltr"><<a href="mailto:david.bolvansky@gmail.com" target="_blank">david.bolvansky@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div> Use *last = nullptr;</div><div> for (Use &U : Src->uses())</div><div> last = &U;</div><div> last->getUser()->dump();</div><div><br></div><div><br></div><div>Or any better solution?</div></div><div class="m_-3511743645284496151HOEnZb"><div class="m_-3511743645284496151h5"><div class="gmail_extra"><br><div class="gmail_quote">2018-04-20 19:19 GMT+02:00 Dávid Bolvanský <span dir="ltr"><<a href="mailto:david.bolvansky@gmail.com" target="_blank">david.bolvansky@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Is:<div><br></div></div><div class="m_-3511743645284496151m_-2729136279047827895HOEnZb"><div class="m_-3511743645284496151m_-2729136279047827895h5"><div class="gmail_extra"><br><div class="gmail_quote">2018-04-20 18:07 GMT+02:00 Dávid Bolvanský <span dir="ltr"><<a href="mailto:david.bolvansky@gmail.com" target="_blank">david.bolvansky@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>Code: <a href="https://godbolt.org/g/EG4Wi6" target="_blank">https://godbolt.org/g/EG4Wi6</a></div><div><br></div><div><div style="color:rgb(0,0,0);background-color:rgb(255,255,254)"><div><span style="color:rgb(0,0,255)">unsigned</span> fff3(<span style="color:rgb(0,0,255)">void</span>) {</div><div> <span style="color:rgb(0,0,255)"> char</span> buf[<span style="color:rgb(9,136,90)">10</span>] = <span style="color:rgb(163,21,21)">""</span>;</div><div> <span style="color:rgb(0,0,255)"> return</span> strlen(buf);</div><div>}</div><div><br></div></div></div><div>Since we are memset-ing before strlen call, we could replace strlen with just 0.</div><div><br></div><div>Has LLVM any API to get "last instruction before strlen" which modifies strlen argument "buf"? So we can check "yes, it is memset there, replace strlen with zero" ?</div><div><br></div><div><br></div><div>Thanks</div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>