[llvm-commits] [llvm] r124533 - in /llvm/trunk: lib/Analysis/ValueTracking.cpp test/Transforms/InstSimplify/2011-01-18-Compare.ll

Duncan Sands baldrick at free.fr
Sat Jan 29 05:27:00 PST 2011


Author: baldrick
Date: Sat Jan 29 07:27:00 2011
New Revision: 124533

URL: http://llvm.org/viewvc/llvm-project?rev=124533&view=rev
Log:
Fix typo: should have been testing that X was odd, not V.

Modified:
    llvm/trunk/lib/Analysis/ValueTracking.cpp
    llvm/trunk/test/Transforms/InstSimplify/2011-01-18-Compare.ll

Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=124533&r1=124532&r2=124533&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Sat Jan 29 07:27:00 2011
@@ -715,16 +715,16 @@
   if (isa<SExtInst>(V) || isa<ZExtInst>(V))
     return isKnownNonZero(cast<Instruction>(V)->getOperand(0), TD, Depth);
 
-  // shl X, A != 0 if X is odd.  Note that the value of the shift is undefined
+  // shl X, Y != 0 if X is odd.  Note that the value of the shift is undefined
   // if the lowest bit is shifted off the end.
   if (BitWidth && match(V, m_Shl(m_Value(X), m_Value(Y)))) {
     APInt KnownZero(BitWidth, 0);
     APInt KnownOne(BitWidth, 0);
-    ComputeMaskedBits(V, APInt(BitWidth, 1), KnownZero, KnownOne, TD, Depth);
+    ComputeMaskedBits(X, APInt(BitWidth, 1), KnownZero, KnownOne, TD, Depth);
     if (KnownOne[0])
       return true;
   }
-  // shr X, A != 0 if X is negative.  Note that the value of the shift is not
+  // shr X, Y != 0 if X is negative.  Note that the value of the shift is not
   // defined if the sign bit is shifted off the end.
   else if (match(V, m_Shr(m_Value(X), m_Value(Y)))) {
     bool XKnownNonNegative, XKnownNegative;

Modified: llvm/trunk/test/Transforms/InstSimplify/2011-01-18-Compare.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/2011-01-18-Compare.ll?rev=124533&r1=124532&r2=124533&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/2011-01-18-Compare.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/2011-01-18-Compare.ll Sat Jan 29 07:27:00 2011
@@ -108,3 +108,27 @@
   ret i1 %c
 ; CHECK: ret i1 false
 }
+
+define i1 @shl(i32 %x) {
+; CHECK: @shl
+  %s = shl i32 1, %x
+  %c = icmp eq i32 %s, 0
+  ret i1 %c
+; CHECK: ret i1 false
+}
+
+define i1 @lshr(i32 %x) {
+; CHECK: @lshr
+  %s = lshr i32 -1, %x
+  %c = icmp eq i32 %s, 0
+  ret i1 %c
+; CHECK: ret i1 false
+}
+
+define i1 @ashr(i32 %x) {
+; CHECK: @ashr
+  %s = ashr i32 -1, %x
+  %c = icmp eq i32 %s, 0
+  ret i1 %c
+; CHECK: ret i1 false
+}





More information about the llvm-commits mailing list