From 02dea8b39f3acad5de1df36273444d149145e7fc Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 23 May 2008 21:05:58 +0000 Subject: 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 --- lib/VMCore/BasicBlock.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'lib/VMCore/BasicBlock.cpp') 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(&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(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(i)) ++i; + return &*i; } void BasicBlock::dropAllReferences() { -- cgit v1.2.3-18-g5258