[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat Mar 13 21:25:01 PST 2004
Changes in directory llvm/lib/VMCore:
Verifier.cpp updated: 1.87 -> 1.88
---
Log message:
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.
---
Diffs of the changes: (+8 -3)
Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.87 llvm/lib/VMCore/Verifier.cpp:1.88
--- llvm/lib/VMCore/Verifier.cpp:1.87 Sat Mar 13 21:16:15 2004
+++ llvm/lib/VMCore/Verifier.cpp Sat Mar 13 21:23:54 2004
@@ -508,11 +508,16 @@
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<Function>(I.getOperand(i)))
+ if (Function *F = dyn_cast<Function>(I.getOperand(i))) {
Assert1(!F->isIntrinsic() || (i == 0 && isa<CallInst>(I)),
"Cannot take the address of an intrinsic!", &I);
-
- else if (Instruction *Op = dyn_cast<Instruction>(I.getOperand(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 (Instruction *Op = dyn_cast<Instruction>(I.getOperand(i))) {
BasicBlock *OpBlock = Op->getParent();
// Check that a definition dominates all of its uses.
More information about the llvm-commits
mailing list