RegionInfo: Make sure to free cached nodes; Tobias, please check!
authorDaniel Dunbar <daniel@zuster.org>
Wed, 28 Jul 2010 20:28:50 +0000 (20:28 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 28 Jul 2010 20:28:50 +0000 (20:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109650 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/RegionInfo.cpp

index ac660e72f07a927101124b753fe3380715aeb1e7..6f38dcc9681c50a80a265e7b9b59fe0aa9b5e4b8 100644 (file)
@@ -59,6 +59,11 @@ Region::Region(BasicBlock *Entry, BasicBlock *Exit, RegionInfo* RInfo,
                : RegionNode(Parent, Entry, 1), RI(RInfo), DT(dt), exit(Exit) {}
 
 Region::~Region() {
+  // Free the cached nodes.
+  for (BBNodeMapT::iterator it = BBNodeMap.begin(),
+         ie = BBNodeMap.end(); it != ie; ++it)
+    delete it->second;
+
   // Only clean the cache for this Region. Caches of child Regions will be
   // cleaned when the child Regions are deleted.
   BBNodeMap.clear();