From c268ced34e2774a160d0d84d058664dc63512308 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Fri, 2 Apr 2010 21:49:27 +0000 Subject: Skip debug info when looking for existing EH calls at the beginning of a block. llvm-svn: 100230 --- llvm/lib/VMCore/BasicBlock.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'llvm/lib/VMCore/BasicBlock.cpp') 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(i) || isa(i)) ++i; + return &*i; +} + void BasicBlock::dropAllReferences() { for(iterator I = begin(), E = end(); I != E; ++I) I->dropAllReferences(); -- cgit v1.2.3