mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-08 19:25:47 +00:00
Tell ScalarEvolution to forget a loop before starting to delete it.
This way ScalarEvolution can examine the loop to determine what state it needs to update, if it chooses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75029 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -199,7 +199,12 @@ bool LoopDeletion::runOnLoop(Loop* L, LPPassManager& LPM) {
|
|||||||
// Because we're deleting a large chunk of code at once, the sequence in which
|
// Because we're deleting a large chunk of code at once, the sequence in which
|
||||||
// we remove things is very important to avoid invalidation issues. Don't
|
// we remove things is very important to avoid invalidation issues. Don't
|
||||||
// mess with this unless you have good reason and know what you're doing.
|
// mess with this unless you have good reason and know what you're doing.
|
||||||
|
|
||||||
|
// Tell ScalarEvolution that the loop is deleted. Do this before
|
||||||
|
// deleting the loop so that ScalarEvolution can look at the loop
|
||||||
|
// to determine what it needs to clean up.
|
||||||
|
SE.forgetLoopBackedgeTakenCount(L);
|
||||||
|
|
||||||
// Move simple loop-invariant expressions out of the loop, since they
|
// Move simple loop-invariant expressions out of the loop, since they
|
||||||
// might be needed by the exit phis.
|
// might be needed by the exit phis.
|
||||||
for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
|
for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
|
||||||
@@ -248,11 +253,6 @@ bool LoopDeletion::runOnLoop(Loop* L, LPPassManager& LPM) {
|
|||||||
(*LI)->dropAllReferences();
|
(*LI)->dropAllReferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell ScalarEvolution that the loop is deleted. Do this before
|
|
||||||
// deleting the loop so that ScalarEvolution can look at the loop
|
|
||||||
// to determine what it needs to clean up.
|
|
||||||
SE.forgetLoopBackedgeTakenCount(L);
|
|
||||||
|
|
||||||
// Erase the instructions and the blocks without having to worry
|
// Erase the instructions and the blocks without having to worry
|
||||||
// about ordering because we already dropped the references.
|
// about ordering because we already dropped the references.
|
||||||
// NOTE: This iteration is safe because erasing the block does not remove its
|
// NOTE: This iteration is safe because erasing the block does not remove its
|
||||||
|
Reference in New Issue
Block a user