[llvm-commits] CVS: llvm/include/llvm/Analysis/LoopInfo.h

Chris Lattner lattner at cs.uiuc.edu
Wed Jun 29 10:41:36 PDT 2005



Changes in directory llvm/include/llvm/Analysis:

LoopInfo.h updated: 1.48 -> 1.49
---
Log message:

Don't crash on a query where the block is not in any loop.  Thanks to
Sameer D. Sahasrabuddhe for pointing this out!



---
Diffs of the changes:  (+2 -1)

 LoopInfo.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/Analysis/LoopInfo.h
diff -u llvm/include/llvm/Analysis/LoopInfo.h:1.48 llvm/include/llvm/Analysis/LoopInfo.h:1.49
--- llvm/include/llvm/Analysis/LoopInfo.h:1.48	Sun May 15 12:23:19 2005
+++ llvm/include/llvm/Analysis/LoopInfo.h	Wed Jun 29 12:41:25 2005
@@ -250,7 +250,8 @@
 
   // 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.






More information about the llvm-commits mailing list