<div dir="ltr">Yes, I was proposing something like <a href="https://ghostbin.com/paste/r5uou">https://ghostbin.com/paste/r5uou</a></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 5, 2016 at 2:05 PM, Carlos Liam 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">Looks like LVI actually does have cases for max and min; would it be better to allow ValueTracking to use range analysis instead?<br>
<span class="HOEnZb"><font color="#888888"><br>
 - CL<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> On Aug 1, 2016, at 8:44 PM, Philip Reames <<a href="mailto:listmail@philipreames.com">listmail@philipreames.com</a>> wrote:<br>
><br>
>> On 07/29/2016 07:08 PM, Carlos Liam via llvm-dev wrote:<br>
>> Hi all,<br>
>><br>
>> Say we have this IR:<br>
>><br>
>> %1 = icmp slt i16 %x, 0<br>
>> %.x = select i1 %1, i16 0, i16 %x<br>
>><br>
>> This is the canonical form of what is effectively max(x, 0).<br>
>><br>
>> From what I can tell LLVM has no facilities to determine from this code that %.x >= 0, so (for example) an SExt on %.x will not be converted to a ZExt.<br>
>><br>
>> I'm interested in seeing what sorts of changes would be needed to recognize this pattern in existing facilities (computeKnownBits, etc.) in order to more broadly apply optimizations that use those facilities.<br>
> LVI has a couple of special cases around select idioms.  This would be another reasonable one to add.  This would give range analysis (used in JumpThreading and CVP) for this idiom.  I thought we already had this one actually.<br>
>><br>
>> Any insight would be appreciated. Thanks!<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>
><br>
<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>
</div></div></blockquote></div><br></div>