diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2012-07-03 21:15:40 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2012-07-03 21:15:40 +0000 |
commit | 0d44a504260ca64db82f46b4ba770f48a5fb9d09 (patch) | |
tree | 1cb69059833e03e157228028b81d4508bf27db12 /llvm | |
parent | c8a0ce0a7ad3983443ea49e6bece28ae1d0ffece (diff) | |
download | bcm5719-llvm-0d44a504260ca64db82f46b4ba770f48a5fb9d09.tar.gz bcm5719-llvm-0d44a504260ca64db82f46b4ba770f48a5fb9d09.zip |
PHINode::hasConstantValue(): return undef if the PHI is fully recursive.
Thanks Duncan for the idea
llvm-svn: 159687
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/VMCore/Instructions.cpp | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index d245783ec65..cea34e16e7b 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -694,7 +694,7 @@ void llvm::ComputeMaskedBits(Value *V, APInt &KnownZero, APInt &KnownOne, // 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) + if (dyn_cast_or_null<UndefValue>(P->hasConstantValue())) break; KnownZero = APInt::getAllOnesValue(BitWidth); diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp index 5aef4592501..9af98e8a9b3 100644 --- a/llvm/lib/VMCore/Instructions.cpp +++ b/llvm/lib/VMCore/Instructions.cpp @@ -167,6 +167,8 @@ Value *PHINode::hasConstantValue() const { // The case where the first value is this PHI. ConstantValue = getIncomingValue(i); } + if (ConstantValue == this) + return UndefValue::get(getType()); return ConstantValue; } |