forked from OSchip/llvm-project
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
This commit is contained in:
parent
51e2a48b35
commit
f550554c02
|
@ -250,7 +250,8 @@ public:
|
||||||
|
|
||||||
// isLoopHeader - True if the block is a loop header node
|
// isLoopHeader - True if the block is a loop header node
|
||||||
bool isLoopHeader(BasicBlock *BB) const {
|
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.
|
/// runOnFunction - Calculate the natural loop information.
|
||||||
|
|
Loading…
Reference in New Issue