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 <mjam...@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. */