(*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
// about ordering because we already dropped the references.
// NOTE: This iteration is safe because erasing the block does not remove its
LI != LE; ++LI)
(*LI)->eraseFromParent();
- // Tell ScalarEvolution that the loop is deleted.
- SE.forgetLoopBackedgeTakenCount(L);
-
// Finally, the blocks from loopinfo. This has to happen late because
// otherwise our loop iterators won't work.
LoopInfo& loopInfo = getAnalysis<LoopInfo>();