diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 17 | 
1 files changed, 17 insertions, 0 deletions
| diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index c22485342e0..aa6efe80b32 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -148,6 +148,23 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB) {    return false;  } +//===----------------------------------------------------------------------===// +//  CFG Simplification +// + +/// isTerminatorFirstRelevantInsn - Return true if Term is very first  +/// instruction ignoring Phi nodes and dbg intrinsics. +bool llvm::isTerminatorFirstRelevantInsn(BasicBlock *BB, Instruction *Term) { +  BasicBlock::iterator BBI = Term; +  while (BBI != BB->begin()) { +    --BBI; +    if (!isa<DbgInfoIntrinsic>(BBI)) +      break; +  } +  if (isa<PHINode>(BBI) || &*BBI == Term) +    return true; +  return false; +}  //===----------------------------------------------------------------------===//  //  Local dead code elimination... | 

