This fixes a bug with the previous recursion inhibit of gimple_register_type. It also re-introduces the patch that makes us compare names not of the main-variant but of the type itself. And finally it makes us produce more stable hashes by hashing the types in the tree SCC as it was read in original and not eventually of some intermediate fixuped state.
LTO bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2011-05-19 Richard Guenther <rguent...@suse.de> * gimple.c (gimple_types_compatible_p_1): Compare names of the types themselves. (iterative_hash_gimple_type): And hash them that way. (gimple_register_type_1): If we register a main variant properly initialize the leader to ourselves. lto/ * lto.c (uniquify_nodes): First register all types before fixing up the tree SCC. Index: gcc/gimple.c =================================================================== *** gcc/gimple.c (revision 173894) --- gcc/gimple.c (working copy) *************** gimple_types_compatible_p_1 (tree t1, tr *** 3824,3831 **** tree f1, f2; /* The struct tags shall compare equal. */ ! if (!compare_type_names_p (TYPE_MAIN_VARIANT (t1), ! TYPE_MAIN_VARIANT (t2), false)) goto different_types; /* For aggregate types, all the fields must be the same. */ --- 3824,3830 ---- tree f1, f2; /* The struct tags shall compare equal. */ ! if (!compare_type_names_p (t1, t2, false)) goto different_types; /* For aggregate types, all the fields must be the same. */ *************** iterative_hash_gimple_type (tree type, h *** 4202,4208 **** unsigned nf; tree f; ! v = iterative_hash_name (TYPE_NAME (TYPE_MAIN_VARIANT (type)), v); for (f = TYPE_FIELDS (type), nf = 0; f; f = TREE_CHAIN (f)) { --- 4201,4207 ---- unsigned nf; tree f; ! v = iterative_hash_name (TYPE_NAME (type), v); for (f = TYPE_FIELDS (type), nf = 0; f; f = TREE_CHAIN (f)) { *************** gimple_register_type_1 (tree t, bool reg *** 4503,4509 **** { void **slot; gimple_type_leader_entry *leader; ! tree mv_leader = NULL_TREE; /* If we registered this type before return the cached result. */ leader = &gimple_type_leader[TYPE_UID (t) % GIMPLE_TYPE_LEADER_SIZE]; --- 4502,4508 ---- { void **slot; gimple_type_leader_entry *leader; ! tree mv_leader; /* If we registered this type before return the cached result. */ leader = &gimple_type_leader[TYPE_UID (t) % GIMPLE_TYPE_LEADER_SIZE]; *************** gimple_register_type_1 (tree t, bool reg *** 4516,4525 **** It also makes sure that main variants will be merged to main variants. As we are operating on a possibly partially fixed up type graph do not bother to recurse more than once, otherwise we may end up ! walking in circles. */ if (!registering_mv && TYPE_MAIN_VARIANT (t) != t) mv_leader = gimple_register_type_1 (TYPE_MAIN_VARIANT (t), true); slot = htab_find_slot (gimple_types, t, INSERT); if (*slot --- 4515,4529 ---- It also makes sure that main variants will be merged to main variants. As we are operating on a possibly partially fixed up type graph do not bother to recurse more than once, otherwise we may end up ! walking in circles. ! If we are registering a main variant it will either remain its ! own main variant or it will be merged to something else in which ! case we do not care for the main variant leader. */ if (!registering_mv && TYPE_MAIN_VARIANT (t) != t) mv_leader = gimple_register_type_1 (TYPE_MAIN_VARIANT (t), true); + else + mv_leader = t; slot = htab_find_slot (gimple_types, t, INSERT); if (*slot Index: gcc/lto/lto.c =================================================================== *** gcc/lto/lto.c (revision 173894) --- gcc/lto/lto.c (working copy) *************** uniquify_nodes (struct data_in *data_in, *** 605,610 **** --- 605,624 ---- struct lto_streamer_cache_d *cache = data_in->reader_cache; unsigned len = VEC_length (tree, cache->nodes); unsigned i; + + /* Go backwards because childs streamed for the first time come + as part of their parents, and hence are created after them. */ + for (i = len; i-- > from;) + { + tree t = VEC_index (tree, cache->nodes, i); + if (!t) + continue; + + /* Now try to find a canonical variant of T itself. */ + if (TYPE_P (t)) + gimple_register_type (t); + } + /* Go backwards because childs streamed for the first time come as part of their parents, and hence are created after them. */ for (i = len; i-- > from;)