[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp

Chris Lattner sabre at nondot.org
Fri Apr 20 14:48:27 PDT 2007



Changes in directory llvm/lib/VMCore:

Verifier.cpp updated: 1.203 -> 1.204
---
Log message:

catch a case that was biting jeffc


---
Diffs of the changes:  (+7 -1)

 Verifier.cpp |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletion(-)


Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.203 llvm/lib/VMCore/Verifier.cpp:1.204
--- llvm/lib/VMCore/Verifier.cpp:1.203	Tue Apr 17 12:36:12 2007
+++ llvm/lib/VMCore/Verifier.cpp	Fri Apr 20 16:48:08 2007
@@ -867,12 +867,17 @@
       // taken.
       Assert1(!F->isIntrinsic() || (i == 0 && isa<CallInst>(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<BasicBlock>(I.getOperand(i))) {
       Assert1(OpBB->getParent() == BB->getParent(),
               "Referring to a basic block in another function!", &I);
     } else if (Argument *OpArg = dyn_cast<Argument>(I.getOperand(i))) {
       Assert1(OpArg->getParent() == BB->getParent(),
               "Referring to an argument in another function!", &I);
+    } else if (GlobalValue *GV = dyn_cast<GlobalValue>(I.getOperand(i))) {
+      Assert1(GV->getParent() == Mod, "Referencing global in another module!",
+              &I);
     } else if (Instruction *Op = dyn_cast<Instruction>(I.getOperand(i))) {
       BasicBlock *OpBlock = Op->getParent();
 
@@ -952,7 +957,8 @@
 ///
 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"






More information about the llvm-commits mailing list