1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

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.

llvm-svn: 18484
This commit is contained in:
Alkis Evlogimenos 2004-12-04 02:30:42 +00:00
parent edf490b75e
commit 7202acacf7

View File

@ -321,6 +321,9 @@ void Verifier::visitFunction(Function &F) {
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 @@ void Verifier::visitBasicBlock(BasicBlock &BB) {
}
}
}
// Ensure that basic blocks have terminators!
Assert1(BB.getTerminator(), "Basic Block does not have terminator!", &BB);
}
void Verifier::visitTerminatorInst(TerminatorInst &I) {