<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 18, 2015 at 9:48 AM, Nick Lewycky <span dir="ltr"><<a href="mailto:nlewycky@google.com" target="_blank">nlewycky@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On 17 September 2015 at 22:25, Larisse Voufo <span dir="ltr"><<a href="mailto:lvoufo@gmail.com" target="_blank">lvoufo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">lvoufo added a comment.<br>
<span><br>
<br>
<br>
> -2-<br>
<br>
>  Does "opt -basicaa -gvn" clean up the redundant load? If so, is it okay that instcombine doesn't?<br>
<br>
<br>
</span>Now it does, as of Diff 35065 of <a href="http://reviews.llvm.org/D11826" rel="noreferrer" target="_blank">http://reviews.llvm.org/D11826</a>.</blockquote><div><br></div></span><div>Is that the correct link? That appears to introduce a new LLVM IR feature that changes both clang and llvm. </div></div></div></div></blockquote><div>It does introduce a new feature that would remove redundant loads. </div><div><br></div><div>Right now, neither -instcombine nor -gvn remove the redundant loads I am working with. </div><div>With the new feature, -gvn definitely does, while -instcombine does sometimes.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>If the transform is legal for instcombine to do, then it's also legal for gvn to do with no new IR features involved.</div></div></div></div></blockquote><div>This relationship is preserved with the new feature. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> But it still does not make it okay imo since once might still expect<br>
something like "-basicaa -instcombine -inline -early-cse -instcombine" to remove redundant loads when<br>
"-basicaa -instcombine -early-cse -instcombine" does.<br></blockquote><div><br></div></span><div>Well, yeah. I think it's unreasonable to expect instcombine to hack on your loads, but it does and I'll just move right along. What would surprise me is if instcombine folded redundant loads that gvn couldn't. That would suggest a problem in gvn...</div></div></div></div></blockquote><div> </div><div>Yup. You should checkout <a href="http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20081124/070428.html">r60148</a>. From the commit message, -instcombine (as it later on uses FindAvailableLoadedValue()) should be expected to remove "locally redundant" and "partially redundant" loads.</div><div> </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><a href="http://reviews.llvm.org/D12886" rel="noreferrer" target="_blank">http://reviews.llvm.org/D12886<br></a></blockquote><div> </div></div></div></div>
</blockquote></div><br></div></div>