mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 19:07:53 +08:00
PHINode::hasConstantValue(): return undef if the PHI is fully recursive.
Thanks Duncan for the idea llvm-svn: 159687
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user