[llvm-commits] [PATCH] RegionInfo: Also free cached nodes when we clear the node cache.

ether zhhb etherzhhb at gmail.com
Wed Aug 18 07:25:03 PDT 2010


Hi,

i also notice that in function clearNodeCahche of region class, we
forget to delete the cached node before we clear the map.

best regards
ether

---
 lib/Analysis/RegionInfo.cpp |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/lib/Analysis/RegionInfo.cpp b/lib/Analysis/RegionInfo.cpp
index abc057a..dfc76db 100644
--- a/lib/Analysis/RegionInfo.cpp
+++ b/lib/Analysis/RegionInfo.cpp
@@ -376,6 +376,11 @@ void Region::dump() const {
 }

 void Region::clearNodeCache() {
+  // Free the cached nodes.
+  for (BBNodeMapT::iterator it = BBNodeMap.begin(),
+      ie = BBNodeMap.end(); it != ie; ++it)
+    delete it->second;
+
   BBNodeMap.clear();
   for (Region::iterator RI = begin(), RE = end(); RI != RE; ++RI)
     (*RI)->clearNodeCache();
-- 
1.7.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-RegionInfo-Also-free-cached-nodes-when-we-clear-the-.patch
Type: application/octet-stream
Size: 862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100818/dba829be/attachment.obj>


More information about the llvm-commits mailing list