From 9ece94b02bf9d20cfcf542b35b88afdab046e741 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 14 Mar 2004 03:23:54 +0000 Subject: Catch some more cases of broken code. The loop extractor seems to be creating situations where there is a branch that goes to a block in another function. llvm-svn: 12379 --- llvm/lib/VMCore/Verifier.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp index 768bf4dc814..73285cddde6 100644 --- a/llvm/lib/VMCore/Verifier.cpp +++ b/llvm/lib/VMCore/Verifier.cpp @@ -508,11 +508,16 @@ void Verifier::visitInstruction(Instruction &I) { for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) { // Check to make sure that the "address of" an intrinsic function is never // taken. - if (Function *F = dyn_cast(I.getOperand(i))) + if (Function *F = dyn_cast(I.getOperand(i))) { Assert1(!F->isIntrinsic() || (i == 0 && isa(I)), "Cannot take the address of an intrinsic!", &I); - - else if (Instruction *Op = dyn_cast(I.getOperand(i))) { + } else if (BasicBlock *OpBB = dyn_cast(I.getOperand(i))) { + Assert1(OpBB->getParent() == BB->getParent(), + "Referring to a basic block in another function!", &I); + } else if (Argument *OpArg = dyn_cast(I.getOperand(i))) { + Assert1(OpArg->getParent() == BB->getParent(), + "Referring to an argument in another function!", &I); + } else if (Instruction *Op = dyn_cast(I.getOperand(i))) { BasicBlock *OpBlock = Op->getParent(); // Check that a definition dominates all of its uses. -- cgit v1.2.3