summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-06-29 17:41:25 +0000
committerChris Lattner <sabre@nondot.org>2005-06-29 17:41:25 +0000
commitf550554c02790a88f31c4ea6de7f3522a08072cc (patch)
tree0da444e17d85385d4b4d481d9d23e0124115874d /llvm
parent51e2a48b350235fdf054d9fb729cdfce8656c508 (diff)
downloadbcm5719-llvm-f550554c02790a88f31c4ea6de7f3522a08072cc.tar.gz
bcm5719-llvm-f550554c02790a88f31c4ea6de7f3522a08072cc.zip
Don't crash on a query where the block is not in any loop. Thanks to
Sameer D. Sahasrabuddhe for pointing this out! llvm-svn: 22314
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Analysis/LoopInfo.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/include/llvm/Analysis/LoopInfo.h b/llvm/include/llvm/Analysis/LoopInfo.h
index 5e818bcbe19..9357d8fb6ea 100644
--- a/llvm/include/llvm/Analysis/LoopInfo.h
+++ b/llvm/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.
OpenPOWER on IntegriCloud