[llvm-commits] [llvm] r46900 - /llvm/trunk/lib/VMCore/Verifier.cpp

Chris Lattner sabre at nondot.org
Fri Feb 8 17:06:02 PST 2008

Author: lattner
Date: Fri Feb  8 19:06:01 2008
New Revision: 46900

URL: http://llvm.org/viewvc/llvm-project?rev=46900&view=rev
check that terminators only occur at the end of a block.  This catches the
common problem of putting two terminators in the same block.  I can't write
a testcase for this because the .ll parser rejects this before the verifier
can, but this can occur when generating IR.


Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=46900&r1=46899&r2=46900&view=diff

--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Fri Feb  8 19:06:01 2008
@@ -1051,6 +1051,11 @@
               !DT->dominates(&BB->getParent()->getEntryBlock(), BB),
               "Only PHI nodes may reference their own value!", &I);
+  // Verify that if this is a terminator that it is at the end of the block.
+  if (isa<TerminatorInst>(I))
+    Assert1(BB->getTerminator() == &I, "Terminator not at end of block!", &I);
   // Check that void typed values don't have names
   Assert1(I.getType() != Type::VoidTy || !I.hasName(),

More information about the llvm-commits mailing list