summaryrefslogtreecommitdiffstats
path: root/lib/VMCore/BasicBlock.cpp
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-04-03 07:51:10 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-04-03 07:51:10 +0000
commit62cc576dca6a6aa62c0424f0a1e93a0a679d4c8a (patch)
treeba3309de92b14839b2ca6ca0c6d3b39714f95d4c /lib/VMCore/BasicBlock.cpp
parent20e856b2a58d12231aa42d5d13888b15ac03e5a4 (diff)
downloadFreeBSD-src-62cc576dca6a6aa62c0424f0a1e93a0a679d4c8a.zip
FreeBSD-src-62cc576dca6a6aa62c0424f0a1e93a0a679d4c8a.tar.gz
Update LLVM to r100285.
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 16437bc..8ad5373 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();
OpenPOWER on IntegriCloud