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

David Greene greened at obbligato.org
Mon Oct 27 16:24:04 PDT 2008


Author: greened
Date: Mon Oct 27 18:24:03 2008
New Revision: 58296

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

Re-apply 55137 with fixes.

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=58296&r1=58295&r2=58296&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/trunk/lib/Analysis/ValueTracking.cpp Mon Oct 27 18:24:03 2008
@@ -509,12 +509,15 @@
           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);
+          ComputeMaskedBits(L, Mask2, KnownZero3, KnownOne3, TD, Depth+1);
+
           KnownZero = Mask &
                       APInt::getLowBitsSet(BitWidth,
-                                           KnownZero2.countTrailingOnes());
+                                           std::min(KnownZero2.countTrailingOnes(),
+                                                    KnownZero3.countTrailingOnes()));
           break;
         }
       }





More information about the llvm-commits mailing list