diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-12-04 02:30:42 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-12-04 02:30:42 +0000 |
commit | 4f4cf99a8662b4ee989c3ead691ba586221ea44b (patch) | |
tree | 83a768dc918fed6fd010ba64017e5c32201768cc | |
parent | 8b42b43dc24266beb8427acb7d3779dce432496a (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18484 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/VMCore/Verifier.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 3a3e6e5c32..4653ef8955 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -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) { |