summaryrefslogtreecommitdiffstats
path: root/llvm/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
commitc268ced34e2774a160d0d84d058664dc63512308 (patch)
tree80d5e0b11e599f63234f807a68d8d18dd4b6a460 /llvm/lib/VMCore/BasicBlock.cpp
parent010b373cf3143906a4efeda0a8d8d836506ae846 (diff)
downloadbcm5719-llvm-c268ced34e2774a160d0d84d058664dc63512308.tar.gz
bcm5719-llvm-c268ced34e2774a160d0d84d058664dc63512308.zip
Skip debug info when looking for existing EH calls at the
beginning of a block. llvm-svn: 100230
Diffstat (limited to 'llvm/lib/VMCore/BasicBlock.cpp')
-rw-r--r--llvm/lib/VMCore/BasicBlock.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/BasicBlock.cpp b/llvm/lib/VMCore/BasicBlock.cpp
index 16437bc1304..8ad53736c99 100644
--- a/llvm/lib/VMCore/BasicBlock.cpp
+++ b/llvm/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();
OpenPOWER on IntegriCloud