mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-23 02:32:11 +00:00
PHINode::hasConstantValue should never return the PHI itself, even if the
PHI is its only operand. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22676 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
80f4d88a97
commit
d7231ac523
@ -138,8 +138,11 @@ void PHINode::resizeOperands(unsigned NumOps) {
|
|||||||
Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const {
|
Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const {
|
||||||
// If the PHI node only has one incoming value, eliminate the PHI node...
|
// If the PHI node only has one incoming value, eliminate the PHI node...
|
||||||
if (getNumIncomingValues() == 1)
|
if (getNumIncomingValues() == 1)
|
||||||
return getIncomingValue(0);
|
if (getIncomingValue(0) != this) // not X = phi X
|
||||||
|
return getIncomingValue(0);
|
||||||
|
else
|
||||||
|
return UndefValue::get(getType()); // Self cycle is dead.
|
||||||
|
|
||||||
// Otherwise if all of the incoming values are the same for the PHI, replace
|
// Otherwise if all of the incoming values are the same for the PHI, replace
|
||||||
// the PHI node with the incoming value.
|
// the PHI node with the incoming value.
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user