[llvm-commits] CVS: llvm/lib/Analysis/LoopInfo.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Oct 22 11:42:02 PDT 2003
Changes in directory llvm/lib/Analysis:
LoopInfo.cpp updated: 1.43 -> 1.44
---
Log message:
Do not add unreachable code to a natural loop!
---
Diffs of the changes: (+4 -1)
Index: llvm/lib/Analysis/LoopInfo.cpp
diff -u llvm/lib/Analysis/LoopInfo.cpp:1.43 llvm/lib/Analysis/LoopInfo.cpp:1.44
--- llvm/lib/Analysis/LoopInfo.cpp:1.43 Mon Oct 20 14:43:04 2003
+++ llvm/lib/Analysis/LoopInfo.cpp Wed Oct 22 11:41:21 2003
@@ -151,11 +151,14 @@
Loop *L = new Loop(BB);
BBMap[BB] = L;
+ BasicBlock *EntryBlock = &BB->getParent()->getEntryBlock();
+
while (!TodoStack.empty()) { // Process all the nodes in the loop
BasicBlock *X = TodoStack.back();
TodoStack.pop_back();
- if (!L->contains(X)) { // As of yet unprocessed??
+ if (!L->contains(X) && // As of yet unprocessed??
+ DS.dominates(EntryBlock, X)) { // X is reachable from entry block?
// Check to see if this block already belongs to a loop. If this occurs
// then we have a case where a loop that is supposed to be a child of the
// current loop was processed before the current loop. When this occurs,
More information about the llvm-commits
mailing list