From aff65c98a2c542ba46eb3ac64742adae6faa35df Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 20 Apr 2007 21:48:08 +0000 Subject: [PATCH] catch a case that was biting jeffc llvm-svn: 36284 --- lib/VMCore/Verifier.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 98f26495ce0..c0a0dc6e699 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -867,12 +867,17 @@ void Verifier::visitInstruction(Instruction &I) { // taken. Assert1(!F->isIntrinsic() || (i == 0 && isa(I)), "Cannot take the address of an intrinsic!", &I); + Assert1(F->getParent() == Mod, "Referencing function in another module!", + &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 (GlobalValue *GV = dyn_cast(I.getOperand(i))) { + Assert1(GV->getParent() == Mod, "Referencing global in another module!", + &I); } else if (Instruction *Op = dyn_cast(I.getOperand(i))) { BasicBlock *OpBlock = Op->getParent(); @@ -952,7 +957,8 @@ void Verifier::visitInstruction(Instruction &I) { /// void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { Function *IF = CI.getCalledFunction(); - Assert1(IF->isDeclaration(), "Intrinsic functions should never be defined!", IF); + Assert1(IF->isDeclaration(), "Intrinsic functions should never be defined!", + IF); #define GET_INTRINSIC_VERIFIER #include "llvm/Intrinsics.gen"