diff mbox

[LTO] Re-assign BINFOs when unifying types

Message ID 20110810204059.GA6942@virgil.arch.suse.de
State New
Headers show

Commit Message

Martin Jambor Aug. 10, 2011, 8:41 p.m. UTC
Hi,

the following patch sets BINFOs of prevailing but non-main-variant
types to what the main variant has, so that for a type t with a binfo
the following is always true:

TYPE_BINFO (t) == TYPE_BINFO (TYPE_MAIN_VARIANT (t))

as I I believe in non-LTO world it always is.  Moreover, the BINFO
trees of non-prevailing type nodes now always get garbage collected
(at least as far as my experiments with 483.xalancbmk go).  The memory
savings are negligible, but still I think we should do it.

Bootstrapped and tested on x86_64-linux, also tested by LTOing Mozilla
Firefox and 483.xalancbmk.

OK for trunk?

Thanks,

Martin


2011-08-03  Martin Jambor  <mjambor@suse.cz>

	* lto.c (uniquify_nodes): Use main variant's BINFO too.

Comments

Richard Biener Aug. 11, 2011, 7:11 a.m. UTC | #1
On Wed, 10 Aug 2011, Martin Jambor wrote:

> Hi,
> 
> the following patch sets BINFOs of prevailing but non-main-variant
> types to what the main variant has, so that for a type t with a binfo
> the following is always true:
> 
> TYPE_BINFO (t) == TYPE_BINFO (TYPE_MAIN_VARIANT (t))
> 
> as I I believe in non-LTO world it always is.  Moreover, the BINFO
> trees of non-prevailing type nodes now always get garbage collected
> (at least as far as my experiments with 483.xalancbmk go).  The memory
> savings are negligible, but still I think we should do it.
> 
> Bootstrapped and tested on x86_64-linux, also tested by LTOing Mozilla
> Firefox and 483.xalancbmk.
> 
> OK for trunk?

Ok.

Thanks,
Richard.

> Thanks,
> 
> Martin
> 
> 
> 2011-08-03  Martin Jambor  <mjambor@suse.cz>
> 
> 	* lto.c (uniquify_nodes): Use main variant's BINFO too.
> 
> Index: src/gcc/lto/lto.c
> ===================================================================
> --- src.orig/gcc/lto/lto.c
> +++ src/gcc/lto/lto.c
> @@ -720,6 +720,8 @@ uniquify_nodes (struct data_in *data_in,
>  	    {
>  	      TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (mv);
>  	      TYPE_NEXT_VARIANT (mv) = t;
> +	      if (RECORD_OR_UNION_TYPE_P (t))
> +		TYPE_BINFO (t) = TYPE_BINFO (mv);
>  	    }
>  
>  	  /* Finally adjust our main variant and fix it up.  */
> 
>
diff mbox

Patch

Index: src/gcc/lto/lto.c
===================================================================
--- src.orig/gcc/lto/lto.c
+++ src/gcc/lto/lto.c
@@ -720,6 +720,8 @@  uniquify_nodes (struct data_in *data_in,
 	    {
 	      TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (mv);
 	      TYPE_NEXT_VARIANT (mv) = t;
+	      if (RECORD_OR_UNION_TYPE_P (t))
+		TYPE_BINFO (t) = TYPE_BINFO (mv);
 	    }
 
 	  /* Finally adjust our main variant and fix it up.  */