Re: Free constructor elts in LTO merging

2014-02-07 Thread Richard Biener
On Thu, 6 Feb 2014, Jan Hubicka wrote:

 Hi,
 according to memory stats this is relatively common reason for garbage left
 after tree merging.
 
 Bootstrapped/regtested x86_64-linux, OK?

As CONSTRUCTOR_ELTS is a vec, va_gc please use

  if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
vec_free (CONSTRUCTOR_ELTS (scc-entries[i]));

Ok with that change.

Thanks,
Richard.

 Honza
 
   * lto/lto.c (unify_scc): Free also CONSTRUCTOR_ELTS.
 Index: lto/lto.c
 ===
 --- lto/lto.c (revision 207515)
 +++ lto/lto.c (working copy)
 @@ -1807,8 +1807,13 @@ unify_scc (struct streamer_tree_cache_d
 /* Free the tree nodes from the read SCC.  */
 for (unsigned i = 0; i  len; ++i)
   {
 +   enum tree_code code;
 if (TYPE_P (scc-entries[i]))
   num_merged_types++;
 +   code = TREE_CODE (scc-entries[i]);
 +   if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR)
 +CONSTRUCTOR_ELTS (scc-entries[i]))
 + ggc_free (CONSTRUCTOR_ELTS (scc-entries[i]));
 ggc_free (scc-entries[i]);
   }
  
 
 

-- 
Richard Biener rguent...@suse.de
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imendorffer


Free constructor elts in LTO merging

2014-02-06 Thread Jan Hubicka
Hi,
according to memory stats this is relatively common reason for garbage left
after tree merging.

Bootstrapped/regtested x86_64-linux, OK?

Honza

* lto/lto.c (unify_scc): Free also CONSTRUCTOR_ELTS.
Index: lto/lto.c
===
--- lto/lto.c   (revision 207515)
+++ lto/lto.c   (working copy)
@@ -1807,8 +1807,13 @@ unify_scc (struct streamer_tree_cache_d
  /* Free the tree nodes from the read SCC.  */
  for (unsigned i = 0; i  len; ++i)
{
+ enum tree_code code;
  if (TYPE_P (scc-entries[i]))
num_merged_types++;
+ code = TREE_CODE (scc-entries[i]);
+ if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR)
+  CONSTRUCTOR_ELTS (scc-entries[i]))
+   ggc_free (CONSTRUCTOR_ELTS (scc-entries[i]));
  ggc_free (scc-entries[i]);
}