summaryrefslogtreecommitdiff
path: root/lib/IR/BasicBlock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/IR/BasicBlock.cpp')
-rw-r--r--lib/IR/BasicBlock.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/IR/BasicBlock.cpp b/lib/IR/BasicBlock.cpp
index 22513924a96dc..938c40182b92d 100644
--- a/lib/IR/BasicBlock.cpp
+++ b/lib/IR/BasicBlock.cpp
@@ -264,7 +264,8 @@ const BasicBlock *BasicBlock::getUniqueSuccessor() const {
}
iterator_range<BasicBlock::phi_iterator> BasicBlock::phis() {
- return make_range<phi_iterator>(dyn_cast<PHINode>(&front()), nullptr);
+ PHINode *P = empty() ? nullptr : dyn_cast<PHINode>(&*begin());
+ return make_range<phi_iterator>(P, nullptr);
}
/// This method is used to notify a BasicBlock that the