aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Analysis/LoopInfo.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index 5e818bcbe1..9357d8fb6e 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -250,7 +250,8 @@ public:
// isLoopHeader - True if the block is a loop header node
bool isLoopHeader(BasicBlock *BB) const {
- return getLoopFor(BB)->getHeader() == BB;
+ const Loop *L = getLoopFor(BB);
+ return L && L->getHeader() == BB;
}
/// runOnFunction - Calculate the natural loop information.