aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/BasicBlock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/BasicBlock.cpp')
-rw-r--r--llvm/lib/IR/BasicBlock.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index 00ef10dd53af..d14abafdef2e 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -372,6 +372,12 @@ bool BasicBlock::isLegalToHoistInto() const {
return !Term->isExceptionalTerminator();
}
+bool BasicBlock::isEntryBlock() const {
+ const Function *F = getParent();
+ assert(F && "Block must have a parent function to use this API");
+ return this == &F->getEntryBlock();
+}
+
BasicBlock *BasicBlock::splitBasicBlock(iterator I, const Twine &BBName,
bool Before) {
if (Before)
@@ -455,9 +461,8 @@ void BasicBlock::replaceSuccessorsPhiUsesWith(BasicBlock *Old,
// Cope with being called on a BasicBlock that doesn't have a terminator
// yet. Clang's CodeGenFunction::EmitReturnBlock() likes to do this.
return;
- llvm::for_each(successors(TI), [Old, New](BasicBlock *Succ) {
+ for (BasicBlock *Succ : successors(TI))
Succ->replacePhiUsesWith(Old, New);
- });
}
void BasicBlock::replaceSuccessorsPhiUsesWith(BasicBlock *New) {