X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FAnalysis%2FValueTracking.cpp;h=c51a719313f2a12ae7d000faa27eb86342f10697;hb=24d3b38a0a02a31f524aa73892e1558160ea70bc;hp=3a04f5eb869c8dccee19368374fd5b52f9a82348;hpb=a60832b0187642d01fd726dc766cd62587f6add0;p=oota-llvm.git diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp index 3a04f5eb869..c51a719313f 100644 --- a/lib/Analysis/ValueTracking.cpp +++ b/lib/Analysis/ValueTracking.cpp @@ -509,12 +509,15 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask, 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; } }