<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 20, 2016 at 5:52 PM, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On 20 April 2016 at 14:39, David Majnemer <span dir="ltr"><<a href="mailto:david.majnemer@gmail.com" target="_blank">david.majnemer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">majnemer added a subscriber: majnemer.<br>
<br>
================<br>
Comment at: lib/Analysis/InstructionSimplify.cpp:2630-2639<br>
@@ +2629,12 @@<br>
+      if (Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SGE) {<br>
+        bool RHSKnownNonNegative, RHSKnownNegative;<br>
+        bool YKnownNonNegative, YKnownNegative;<br>
+        ComputeSignBit(RHS, RHSKnownNonNegative, RHSKnownNegative, Q.DL, 0,<br>
+                       <a href="http://Q.AC" rel="noreferrer" target="_blank">Q.AC</a>, Q.CxtI, Q.DT);<br>
+        ComputeSignBit(Y, YKnownNonNegative, YKnownNegative, Q.DL, 0, <a href="http://Q.AC" rel="noreferrer" target="_blank">Q.AC</a>,<br>
+                       Q.CxtI, Q.DT);<br>
+        if (RHSKnownNonNegative && YKnownNegative)<br>
+          return Pred == ICmpInst::ICMP_SLT ? getTrue(ITy) : getFalse(ITy);<br>
+        if (RHSKnownNegative || YKnownNonNegative)<br>
+          return Pred == ICmpInst::ICMP_SLT ? getFalse(ITy) : getTrue(ITy);<br>
+      }<br>
----------------<br>
If I understand correctly, you are saying that x|y < x is true if x is negative and y is not negative.<br>
At first blush, this appears to be a specific case of a more general transform: x|y < x is true if x is negative and y has any bits set which are known not to be set in x.<br></blockquote><div><br></div></span><div>Example x = -2, y = 1.</div><div>-2|1 < -2</div><div>-1 < -2</div><div>false.</div><div><br></div></div></div></div>
</blockquote></div><br></div><div class="gmail_extra">Ah, right; x|y u<= x is false if y has any bits set which are known not to be set in x.</div><div class="gmail_extra">Also, if x and y are both negative then x|y s< x is true if y has any bits set which are known not to be set in x.</div><div class="gmail_extra">However, both of these seem to be distinct from your transforms.</div></div>