LoopInfo: Simplify ownership of Loop objects
[oota-llvm.git] / lib / Analysis / LoopInfo.cpp
index 9ab9eead584fc64956114623d9d2e0a2f2b55acb..0c725fcadff74316d40d3c91be5ebacfbe5b2603 100644 (file)
@@ -637,8 +637,10 @@ LoopInfo::LoopInfo(const DominatorTreeBase<BasicBlock> &DomTree) {
   analyze(DomTree);
 }
 
-void LoopInfo::updateUnloop(Loop *Unloop) {
-  Unloop->markUnlooped();
+void LoopInfo::markAsRemoved(Loop *Unloop) {
+  assert(!Unloop->isInvalid() && "Loop has already been removed");
+  Unloop->invalidate();
+  RemovedLoops.push_back(Unloop);
 
   // First handle the special case of no parent loop to simplify the algorithm.
   if (!Unloop->getParentLoop()) {