<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">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><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>