diff options
author | Dan Gohman <gohman@apple.com> | 2008-05-23 21:05:58 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-05-23 21:05:58 +0000 |
commit | 02dea8b39f3acad5de1df36273444d149145e7fc (patch) | |
tree | 48b58ec848bf21e5f417c3137fca41214104a929 /lib/VMCore/BasicBlock.cpp | |
parent | ee335e35acf20d1ed5b781546d647c19b608890e (diff) |
Tidy up BasicBlock::getFirstNonPHI, and change a bunch of places to
use it instead of duplicating its functionality.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51499 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/BasicBlock.cpp')
-rw-r--r-- | lib/VMCore/BasicBlock.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp index 17469d6bdb..64711fea0c 100644 --- a/lib/VMCore/BasicBlock.cpp +++ b/lib/VMCore/BasicBlock.cpp @@ -143,15 +143,14 @@ const TerminatorInst *BasicBlock::getTerminator() const { return dyn_cast<TerminatorInst>(&InstList.back()); } -Instruction* BasicBlock::getFirstNonPHI() -{ - BasicBlock::iterator i = begin(); - // All valid basic blocks should have a terminator, - // which is not a PHINode. If we have invalid basic - // block we'll get assert when dereferencing past-the-end - // iterator. - while (isa<PHINode>(i)) ++i; - return &*i; +Instruction* BasicBlock::getFirstNonPHI() { + BasicBlock::iterator i = begin(); + // All valid basic blocks should have a terminator, + // which is not a PHINode. If we have an invalid basic + // block we'll get an assertion failure when dereferencing + // a past-the-end iterator. + while (isa<PHINode>(i)) ++i; + return &*i; } void BasicBlock::dropAllReferences() { |