summaryrefslogtreecommitdiff
path: root/lib/VMCore/BasicBlock.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-05-23 21:05:58 +0000
committerDan Gohman <gohman@apple.com>2008-05-23 21:05:58 +0000
commit02dea8b39f3acad5de1df36273444d149145e7fc (patch)
tree48b58ec848bf21e5f417c3137fca41214104a929 /lib/VMCore/BasicBlock.cpp
parentee335e35acf20d1ed5b781546d647c19b608890e (diff)
downloadllvm-02dea8b39f3acad5de1df36273444d149145e7fc.tar.gz
llvm-02dea8b39f3acad5de1df36273444d149145e7fc.tar.bz2
llvm-02dea8b39f3acad5de1df36273444d149145e7fc.tar.xz
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.cpp17
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() {