Remove dead code.
[oota-llvm.git] / lib / VMCore / BasicBlock.cpp
index ab7798c3866e91a82b673516ce7ea2af587114d6..18a90d6b443d10396aa88024e4fdda150ea74ed7 100644 (file)
@@ -121,6 +121,17 @@ const TerminatorInst *const 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;
+}
+
 void BasicBlock::dropAllReferences() {
   for(iterator I = begin(), E = end(); I != E; ++I)
     I->dropAllReferences();