Detect problems with PHI node operands!
authorChris Lattner <sabre@nondot.org>
Wed, 12 Nov 2003 07:13:37 +0000 (07:13 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 12 Nov 2003 07:13:37 +0000 (07:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9916 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Verifier.cpp

index 1362eaab0f6bd80f0a1617147ba7b2def4d3fc9f..d38ed1d5d2ad575dbc8a2dae219b67cec0d07008 100644 (file)
@@ -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);