summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2008-08-21 20:45:12 +0000
committerDavid Greene <greened@obbligato.org>2008-08-21 20:45:12 +0000
commitdce51c372a9b22aaaca4d8258aa63a336c40e5fd (patch)
tree0a1901031f5ae72feea1c3bf70858a588299abb6
parent7e66510a2e24720af187a7aed4c1e9112a823183 (diff)
downloadllvm-dce51c372a9b22aaaca4d8258aa63a336c40e5fd.tar.gz
llvm-dce51c372a9b22aaaca4d8258aa63a336c40e5fd.tar.bz2
llvm-dce51c372a9b22aaaca4d8258aa63a336c40e5fd.tar.xz
Fix ComputeMaskedBits to handle phis correctly. We need to take the
minimum of the known zeros. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55137 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/ValueTracking.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp
index 3a04f5eb86..b956d390a8 100644
--- a/lib/Analysis/ValueTracking.cpp
+++ b/lib/Analysis/ValueTracking.cpp
@@ -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());