From 3b93c91836a05c116e0a21f29cb02058b26f011d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 12 Nov 2003 07:13:37 +0000 Subject: [PATCH] Detect problems with PHI node operands! llvm-svn: 9916 --- llvm/lib/VMCore/Verifier.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp index 1362eaab0f6b..d38ed1d5d2ad 100644 --- a/llvm/lib/VMCore/Verifier.cpp +++ b/llvm/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);