factor some code better.
[oota-llvm.git] / lib / Analysis / ValueTracking.cpp
index b956d390a813370a26b18b2327a2c04014628916..c51a719313f2a12ae7d000faa27eb86342f10697 100644 (file)
@@ -512,13 +512,12 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,
 
           // 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());
+                                           std::min(KnownZero2.countTrailingOnes(),
+                                                    KnownZero3.countTrailingOnes()));
           break;
         }
       }