[llvm-commits] CVS: llvm/lib/Analysis/LoopInfo.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Apr 18 00:38:23 PDT 2004
Changes in directory llvm/lib/Analysis:
LoopInfo.cpp updated: 1.49 -> 1.50
---
Log message:
Add a new method, add a check missing that caused a segfault if a loop didn't
have a canonical indvar
---
Diffs of the changes: (+14 -0)
Index: llvm/lib/Analysis/LoopInfo.cpp
diff -u llvm/lib/Analysis/LoopInfo.cpp:1.49 llvm/lib/Analysis/LoopInfo.cpp:1.50
--- llvm/lib/Analysis/LoopInfo.cpp:1.49 Thu Apr 15 10:16:02 2004
+++ llvm/lib/Analysis/LoopInfo.cpp Sun Apr 18 00:38:05 2004
@@ -315,6 +315,19 @@
"Loops already embedded into a subloop!");
}
+/// removeLoop - This removes the specified top-level loop from this loop info
+/// object. The loop is not deleted, as it will presumably be inserted into
+/// another loop.
+Loop *LoopInfo::removeLoop(iterator I) {
+ assert(I != end() && "Cannot remove end iterator!");
+ Loop *L = *I;
+ assert(L->getParentLoop() == 0 && "Not a top-level loop!");
+ TopLevelLoops.erase(TopLevelLoops.begin() + (I-begin()));
+ return L;
+}
+
+
+
//===----------------------------------------------------------------------===//
// APIs for simple analysis of the loop.
//
@@ -409,6 +422,7 @@
// Canonical loops will end with a 'setne I, V', where I is the incremented
// canonical induction variable and V is the trip count of the loop.
Instruction *Inc = getCanonicalInductionVariableIncrement();
+ if (Inc == 0) return 0;
PHINode *IV = cast<PHINode>(Inc->getOperand(0));
BasicBlock *BackedgeBlock =
More information about the llvm-commits
mailing list