mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-13 09:33:50 +00:00
Add a new method, add a check missing that caused a segfault if a loop didn't
have a canonical indvar git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13032 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4e55b7d2c6
commit
24199db80e
@ -315,6 +315,19 @@ void LoopInfo::changeTopLevelLoop(Loop *OldLoop, Loop *NewLoop) {
|
|||||||
"Loops already embedded into a subloop!");
|
"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.
|
// APIs for simple analysis of the loop.
|
||||||
//
|
//
|
||||||
@ -409,6 +422,7 @@ Value *Loop::getTripCount() const {
|
|||||||
// Canonical loops will end with a 'setne I, V', where I is the incremented
|
// 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.
|
// canonical induction variable and V is the trip count of the loop.
|
||||||
Instruction *Inc = getCanonicalInductionVariableIncrement();
|
Instruction *Inc = getCanonicalInductionVariableIncrement();
|
||||||
|
if (Inc == 0) return 0;
|
||||||
PHINode *IV = cast<PHINode>(Inc->getOperand(0));
|
PHINode *IV = cast<PHINode>(Inc->getOperand(0));
|
||||||
|
|
||||||
BasicBlock *BackedgeBlock =
|
BasicBlock *BackedgeBlock =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user