PHINode::hasConstantValue(): return undef if the PHI is fully recursive.
Thanks Duncan for the idea
llvm-svn: 159687
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp
index 5aef459..9af98e8 100644
--- a/llvm/lib/VMCore/Instructions.cpp
+++ b/llvm/lib/VMCore/Instructions.cpp
@@ -167,6 +167,8 @@
// The case where the first value is this PHI.
ConstantValue = getIncomingValue(i);
}
+ if (ConstantValue == this)
+ return UndefValue::get(getType());
return ConstantValue;
}