diff options
| author | Justin Bogner <mail@justinbogner.com> | 2016-01-08 19:08:53 +0000 |
|---|---|---|
| committer | Justin Bogner <mail@justinbogner.com> | 2016-01-08 19:08:53 +0000 |
| commit | e9fb228d5920f81417b07a13582945d1f5f472f7 (patch) | |
| tree | cde4605f4e27c68fdf8b7892b64885ad57ed8e4a /llvm/lib/Analysis/LoopInfo.cpp | |
| parent | 23bcef990e4e3174c80928087b2970d73bb2283f (diff) | |
| download | bcm5719-llvm-e9fb228d5920f81417b07a13582945d1f5f472f7.tar.gz bcm5719-llvm-e9fb228d5920f81417b07a13582945d1f5f472f7.zip | |
LoopInfo: Simplify ownership of Loop objects
It's strange that LoopInfo mostly owns the Loop objects, but that it
defers deleting them to the loop pass manager. Instead, change the
oddly named "updateUnloop" to "markAsRemoved" and have it queue the
Loop object for deletion. We can't delete the Loop immediately when we
remove it, since we need its pointer identity still, so we'll mark the
object as "invalid" so that clients can see what's going on.
llvm-svn: 257191
Diffstat (limited to 'llvm/lib/Analysis/LoopInfo.cpp')
| -rw-r--r-- | llvm/lib/Analysis/LoopInfo.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp index 9ab9eead584..0c725fcadff 100644 --- a/llvm/lib/Analysis/LoopInfo.cpp +++ b/llvm/lib/Analysis/LoopInfo.cpp @@ -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()) { |

