<div dir="ltr">This should have been squashed with r248073, the functional change is there.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 18, 2015 at 5:48 PM, David Majnemer via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@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">Author: majnemer<br>
Date: Fri Sep 18 19:48:31 2015<br>
New Revision: 248074<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=248074&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=248074&view=rev</a><br>
Log:<br>
[InstCombine] FoldICmpCstShrCst failed for ashr when comparing against -1<br>
<br>
(icmp eq (ashr C1, %V) -1) may have multiple answers if C1 is not a<br>
power of two and has the sign bit set.<br>
<br>
This fixes PR24873.<br>
<br>
Modified:<br>
    llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp<br>
    llvm/trunk/test/Transforms/InstCombine/icmp-shr.ll<br>
<br>
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=248074&r1=248073&r2=248074&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=248074&r1=248073&r2=248074&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Fri Sep 18 19:48:31 2015<br>
@@ -1083,7 +1083,7 @@ Instruction *InstCombiner::FoldICmpCstSh<br>
   if (Shift > 0) {<br>
     if (IsAShr && AP1 == AP2.ashr(Shift)) {<br>
       // There are multiple solutions if we are comparing against -1 and the LHS<br>
-      // of the ashr is not a power of two..<br>
+      // of the ashr is not a power of two.<br>
       if (AP1.isAllOnesValue() && !AP2.isPowerOf2())<br>
         return getICmp(I.ICMP_UGE, A, ConstantInt::get(A->getType(), Shift));<br>
       return getICmp(I.ICMP_EQ, A, ConstantInt::get(A->getType(), Shift));<br>
<br>
Modified: llvm/trunk/test/Transforms/InstCombine/icmp-shr.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/icmp-shr.ll?rev=248074&r1=248073&r2=248074&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/icmp-shr.ll?rev=248074&r1=248073&r2=248074&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/Transforms/InstCombine/icmp-shr.ll (original)<br>
+++ llvm/trunk/test/Transforms/InstCombine/icmp-shr.ll Fri Sep 18 19:48:31 2015<br>
@@ -376,3 +376,12 @@ define i1 @PR21222(i32 %B) {<br>
   %cmp = icmp eq i32 %shr, -2<br>
   ret i1 %cmp<br>
 }<br>
+<br>
+; CHECK-LABEL: @PR24873(<br>
+; CHECK:      %[[icmp:.*]] = icmp ugt i64 %V, 61<br>
+; CHECK-NEXT: ret i1 %[[icmp]]<br>
+define i1 @PR24873(i64 %V) {<br>
+  %ashr = ashr i64 -4611686018427387904, %V<br>
+  %icmp = icmp eq i64 %ashr, -1<br>
+  ret i1 %icmp<br>
+}<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">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><br></div>