Hi Philip,<br><br>Thanks for taking a look!<br><br>I agree that searching an arbitrary size value graph would be horrendously expensive. What I have implemented is to search through unlimited selects and phis (should be cheap, these aren't commonly chained deeply, see GetUnderlyingObjects), and will look through only a certain number of binary operators. The default depth is 1, which will go through one add but no more (configurable by the user). I think overall this should restrict the potential for bloat. <br><br>I have a motivating example which is a chain of selects and phis in a loop. The loop part is important - it's what seems to confuse instcombine currently. What I can do is take a look to see what's causing CVP / LVI to not support this case and report back. Thanks for the hint!<br><br>I'm not sure the last approach you suggested would work for the loop use case, although I haven't thought majorly hard about it just yet. <br><br>Thanks again,<br><br>James<br><div class="gmail_quote"><div dir="ltr">On Fri, 4 Dec 2015 at 20:36, Philip Reames via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">reames added a subscriber: reames.<br>
reames added a comment.<br>
<br>
At a high level, I'm a bit unsure about the formulation chosen here.  I'm worried that seeking to find a set of constant values through a potentially large value graph might be expensive.<br>
<br>
A couple of specific questions:<br>
<br>
- The examples you've listed should be entirely handled by LazyValueInfo and either JumpThreading or CVP.  Do you have a strong reason InstCombine needs to perform the same optimization?<br>
- Have you considered phrasing this as pushing the query (i.e. icmp) back along the inputs?  Doing this might a) let you terminate earlier or b) unswitch the comparison if the select is only used by the compare.<br>
<br>
<br>
<a href="http://reviews.llvm.org/D15232" rel="noreferrer" target="_blank">http://reviews.llvm.org/D15232</a><br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">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>
</blockquote></div>