summaryrefslogtreecommitdiff
path: root/lib/VMCore/BasicBlock.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2010-04-02 21:49:27 +0000
committerDale Johannesen <dalej@apple.com>2010-04-02 21:49:27 +0000
commit7249ef04557cc6f9af7b6df93728683be3b65048 (patch)
tree4379fc07cd2190fe45784617ddb787cc89d9b28a /lib/VMCore/BasicBlock.cpp
parenta144c3f34dd8adc093d9be6cbc3e6f39d47c75dd (diff)
downloadllvm-7249ef04557cc6f9af7b6df93728683be3b65048.tar.gz
llvm-7249ef04557cc6f9af7b6df93728683be3b65048.tar.bz2
llvm-7249ef04557cc6f9af7b6df93728683be3b65048.tar.xz
Skip debug info when looking for existing EH calls at the
beginning of a block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100230 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/BasicBlock.cpp')
-rw-r--r--lib/VMCore/BasicBlock.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp
index 16437bc130..8ad53736c9 100644
--- a/lib/VMCore/BasicBlock.cpp
+++ b/lib/VMCore/BasicBlock.cpp
@@ -14,6 +14,7 @@
#include "llvm/BasicBlock.h"
#include "llvm/Constants.h"
#include "llvm/Instructions.h"
+#include "llvm/IntrinsicInst.h"
#include "llvm/LLVMContext.h"
#include "llvm/Type.h"
#include "llvm/ADT/STLExtras.h"
@@ -136,6 +137,16 @@ Instruction* BasicBlock::getFirstNonPHI() {
return &*i;
}
+Instruction* BasicBlock::getFirstNonPHIOrDbg() {
+ 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) || isa<DbgInfoIntrinsic>(i)) ++i;
+ return &*i;
+}
+
void BasicBlock::dropAllReferences() {
for(iterator I = begin(), E = end(); I != E; ++I)
I->dropAllReferences();