<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 8, 2016 at 8:38 AM, Tobias Edler von Koch via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@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">tobiasvk added a comment.<br>
<span class=""><br>
In <a href="http://reviews.llvm.org/D22051#476003" rel="noreferrer" target="_blank">http://reviews.llvm.org/D22051#476003</a>, @jfb wrote:<br>
<br>
> Could you detail how this is different from MergeFunc, and what it would take to add the new capabilities to MergeFunc instead of duplicating?<br>
<br>
<br>
</span>The main difference is that the in-tree MergeFunctions can only merge identical functions (modulo pointer types) whereas MergeSimilarFunctions is also capable of merging sets of functions that are merely similar, i.e. have some differences in their instructions. </blockquote><div><br></div><div>Two thoughts after staring at it:<br><br></div><div>1. If you were to form SESE/etc regions and process them in topo order, you could actually do even better than you do now.   You would be able to validly say "the first X regions of this function are the same". You currently do this in some cases, but you could do it in more :)</div><div>2. You could integrate most of what you are doing with mergefuncs with a bit of work.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This expands the scope of the optimization significantly.<br>
<br>
As to whether this could be integrated into the in-tree MergeFunctions... Well, this started off as a patch to MergeFunctions back in 2013. However, the in-tree MergeFunctions has undergone significant architectural changes since then; it now uses a total ordering of functions to speed up merging. This is great if you only want to merge identical functions, but it doesn't work for merging of similar functions.<br></blockquote><div><br></div><div>This is not correct.</div><div>You could use simhash, for example, or any thing that will give you actual similarity metrics in addition to total ordering.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
So it really depends on what your optimization goal is. If you want to eliminate duplicates quickly, the in-tree MergeFunctions is great. In our experience, however, the main benefit comes from being able to deal with those small differences here and there that arise e.g. from template instantiations or 'copy-paste-and-hack'.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<a href="http://reviews.llvm.org/D22051" rel="noreferrer" target="_blank">http://reviews.llvm.org/D22051</a><br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div></div>