diff options
author | Chris Lattner <sabre@nondot.org> | 2005-06-29 17:41:25 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-06-29 17:41:25 +0000 |
commit | 50f5490842d501e269a4c6085d0d132cae0d31f8 (patch) | |
tree | 95b93597ebdc4460c1e1a64646abe46847c8a4e1 /include/llvm/Analysis | |
parent | e531ec583b721322f01013c4c1c30acc9f9baf91 (diff) | |
download | external_llvm-50f5490842d501e269a4c6085d0d132cae0d31f8.zip external_llvm-50f5490842d501e269a4c6085d0d132cae0d31f8.tar.gz external_llvm-50f5490842d501e269a4c6085d0d132cae0d31f8.tar.bz2 |
Don't crash on a query where the block is not in any loop. Thanks to
Sameer D. Sahasrabuddhe for pointing this out!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis')
-rw-r--r-- | include/llvm/Analysis/LoopInfo.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index 5e818bc..9357d8f 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. |