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

Alkis Evlogimenos alkis at cs.uiuc.edu
Fri Dec 3 18:30:52 PST 2004



Changes in directory llvm/lib/VMCore:

Verifier.cpp updated: 1.122 -> 1.123
---
Log message:

Check if a block has a terminator first before calling front() on
it. If a block has a terminator then it is certainly non-empty so the
verifier will not crash on it.


---
Diffs of the changes:  (+3 -3)

Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.122 llvm/lib/VMCore/Verifier.cpp:1.123
--- llvm/lib/VMCore/Verifier.cpp:1.122	Fri Dec  3 19:25:06 2004
+++ llvm/lib/VMCore/Verifier.cpp	Fri Dec  3 20:30:42 2004
@@ -321,6 +321,9 @@
 void Verifier::visitBasicBlock(BasicBlock &BB) {
   InstsInThisBlock.clear();
 
+  // Ensure that basic blocks have terminators!
+  Assert1(BB.getTerminator(), "Basic Block does not have terminator!", &BB);
+
   // Check constraints that this basic block imposes on all of the PHI nodes in
   // it.
   if (isa<PHINode>(BB.front())) {
@@ -364,9 +367,6 @@
       }
     }
   }
-
-  // Ensure that basic blocks have terminators!
-  Assert1(BB.getTerminator(), "Basic Block does not have terminator!", &BB);
 }
 
 void Verifier::visitTerminatorInst(TerminatorInst &I) {






More information about the llvm-commits mailing list