aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-11-12 07:13:37 +0000
committerChris Lattner <sabre@nondot.org>2003-11-12 07:13:37 +0000
commit579de71d08a8fd3ae95aa32e5ca89b01db978813 (patch)
treeb8c639223e371e99aba7f119e55441a51bd6e5dd
parent6a45da0de6f22450fff0983d9c7cfb156a99f997 (diff)
Detect problems with PHI node operands!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9916 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/Verifier.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 1362eaab0f..d38ed1d5d2 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -340,6 +340,12 @@ void Verifier::visitPHINode(PHINode &PN) {
"PHI nodes not grouped at top of basic block!",
&PN, PN.getParent());
+ // Check that all of the operands of the PHI node have the same type as the
+ // result.
+ for (unsigned i = 0, e = PN.getNumIncomingValues(); i != e; ++i)
+ Assert1(PN.getType() == PN.getIncomingValue(i)->getType(),
+ "PHI node operands are not the same type as the result!", &PN);
+
// All other PHI node constraints are checked in the visitBasicBlock method.
visitInstruction(PN);