<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I'm wondering if anyone would be willing to help me implement this.<br class=""><div class="">
<br class="Apple-interchange-newline"><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;" class=""> - CL</span>

</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Aug 5, 2016, at 7:58 PM, Carlos Liam <<a href="mailto:carlos@aarzee.me" class="">carlos@aarzee.me</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class=""><div style="direction: inherit;" class="">I actually meant using the range analysis provided by LVI in computeKnownBits, instead of matching select patterns again in computeKnownBits. For example, consider this code:</div><div style="direction: inherit;" class=""><br class=""></div><div style="direction: inherit;" class="">// num is unsigned</div><div style="direction: inherit;" class="">if (num < 4)</div><div style="direction: inherit;" class="">  num = num & 4; // this can be proven to be 0</div><div style="direction: inherit;" class=""><br class=""></div><div style="direction: inherit;" class="">If we allowed computeKnownBits to work in conjunction with range analysis, we could optimize this case.</div><div style="direction: inherit;" class=""><br class=""></div> - CL</div><div class=""><br class="">On Aug 5, 2016, at 5:29 PM, David Majnemer <<a href="mailto:david.majnemer@gmail.com" class="">david.majnemer@gmail.com</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class="">Yes, I was proposing something like <a href="https://ghostbin.com/paste/r5uou" class="">https://ghostbin.com/paste/r5uou</a></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Aug 5, 2016 at 2:05 PM, Carlos Liam via llvm-dev <span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span> wrote:<br class=""><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 class="">
<span class="HOEnZb"><font color="#888888" class=""><br class="">
 - CL<br class="">
</font></span><div class="HOEnZb"><div class="h5"><br class="">
> On Aug 1, 2016, at 8:44 PM, Philip Reames <<a href="mailto:listmail@philipreames.com" class="">listmail@philipreames.com</a>> wrote:<br class="">
><br class="">
>> On 07/29/2016 07:08 PM, Carlos Liam via llvm-dev wrote:<br class="">
>> Hi all,<br class="">
>><br class="">
>> Say we have this IR:<br class="">
>><br class="">
>> %1 = icmp slt i16 %x, 0<br class="">
>> %.x = select i1 %1, i16 0, i16 %x<br class="">
>><br class="">
>> This is the canonical form of what is effectively max(x, 0).<br class="">
>><br class="">
>> 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 class="">
>><br class="">
>> 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 class="">
> 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 class="">
>><br class="">
>> Any insight would be appreciated. Thanks!<br class="">
>> ______________________________<wbr class="">_________________<br class="">
>> LLVM Developers mailing list<br class="">
>> <a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/llvm-dev</a><br class="">
><br class="">
><br class="">
<br class="">
______________________________<wbr class="">_________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/llvm-dev</a><br class="">
</div></div></blockquote></div><br class=""></div>
</div></blockquote></div></div></blockquote></div><br class=""></body></html>