aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2011-03-08 12:39:03 +0000
committerDuncan Sands <baldrick@free.fr>2011-03-08 12:39:03 +0000
commit606199fb85d1c8407615e575b5e8bb5c71be27bd (patch)
tree54f37c7c89cf76912f9dc229854ca77ca4bed090 /lib/Analysis/ValueTracking.cpp
parentc61ac5120ddb5b58693aff42d43cc8e23b7bd0c2 (diff)
downloadexternal_llvm-606199fb85d1c8407615e575b5e8bb5c71be27bd.zip
external_llvm-606199fb85d1c8407615e575b5e8bb5c71be27bd.tar.gz
external_llvm-606199fb85d1c8407615e575b5e8bb5c71be27bd.tar.bz2
Fix PR9331. Simplified version of a patch by Jakub Staszak.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127243 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ValueTracking.cpp')
-rw-r--r--lib/Analysis/ValueTracking.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp
index 231b95b..f05ad66 100644
--- a/lib/Analysis/ValueTracking.cpp
+++ b/lib/Analysis/ValueTracking.cpp
@@ -610,6 +610,10 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,
// Otherwise take the unions of the known bit sets of the operands,
// taking conservative care to avoid excessive recursion.
if (Depth < MaxDepth - 1 && !KnownZero && !KnownOne) {
+ // Skip if every incoming value references to ourself.
+ if (P->hasConstantValue() == P)
+ break;
+
KnownZero = APInt::getAllOnesValue(BitWidth);
KnownOne = APInt::getAllOnesValue(BitWidth);
for (unsigned i = 0, e = P->getNumIncomingValues(); i != e; ++i) {