diff options
Diffstat (limited to 'lib/Analysis/LoopInfo.cpp')
-rw-r--r-- | lib/Analysis/LoopInfo.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp index cd7768f..ef47936 100644 --- a/lib/Analysis/LoopInfo.cpp +++ b/lib/Analysis/LoopInfo.cpp @@ -22,13 +22,21 @@ bool cfg::Loop::contains(const BasicBlock *BB) const { return find(Blocks.begin(), Blocks.end(), BB) != Blocks.end(); } +void cfg::LoopInfo::releaseMemory() { + for (std::vector<Loop*>::iterator I = TopLevelLoops.begin(), + E = TopLevelLoops.end(); I != E; ++I) + delete *I; // Delete all of the loops... + + BBMap.clear(); // Reset internal state of analysis + TopLevelLoops.clear(); +} + //===----------------------------------------------------------------------===// // cfg::LoopInfo implementation // bool cfg::LoopInfo::runOnMethod(Function *F) { - BBMap.clear(); // Reset internal state of analysis - TopLevelLoops.clear(); + releaseMemory(); Calculate(getAnalysis<DominatorSet>()); // Update return false; } |