[llvm-commits] [llvm] r55137 - /llvm/trunk/lib/Analysis/ValueTracking.cpp

David Greene greened at obbligato.org
Thu Aug 21 13:45:13 PDT 2008


Author: greened
Date: Thu Aug 21 15:45:12 2008
New Revision: 55137

URL: http://llvm.org/viewvc/llvm-project?rev=55137&view=rev
Log:

Fix ComputeMaskedBits to handle phis correctly.  We need to take the
minimum of the known zeros.

Modified:
    llvm/trunk/lib/Analysis/ValueTracking.cpp

Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=55137&r1=55136&r2=55137&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Thu Aug 21 15:45:12 2008
@@ -509,9 +509,13 @@
           ComputeMaskedBits(R, Mask2, KnownZero2, KnownOne2, TD, Depth+1);
           Mask2 = APInt::getLowBitsSet(BitWidth,
                                        KnownZero2.countTrailingOnes());
-          KnownOne2.clear();
-          KnownZero2.clear();
-          ComputeMaskedBits(L, Mask2, KnownZero2, KnownOne2, TD, Depth+1);
+
+          // We need to take the minimum number of known bits
+          APInt KnownZero3(KnownZero), KnownOne3(KnownOne);
+          KnownOne3.clear();
+          KnownZero3.clear();
+          ComputeMaskedBits(L, Mask2, KnownZero3, KnownOne3, TD, Depth+1);
+
           KnownZero = Mask &
                       APInt::getLowBitsSet(BitWidth,
                                            KnownZero2.countTrailingOnes());





More information about the llvm-commits mailing list