Fix ComputeMaskedBits to handle phis correctly. We need to take the

minimum of the known zeros.

llvm-svn: 55137
This commit is contained in:
David Greene 2008-08-21 20:45:12 +00:00
parent 5c2ac4a5e0
commit 0d191fd8d1

View File

@ -509,9 +509,13 @@ 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);
KnownOne3.clear();
KnownZero3.clear();
ComputeMaskedBits(L, Mask2, KnownZero3, KnownOne3, TD, Depth+1);
KnownZero = Mask &
APInt::getLowBitsSet(BitWidth,
KnownZero2.countTrailingOnes());