Hi, this patch simplfies types of arrays so we don't propagate duplicates when record/union contains array of pointers. With this we still miss simplification of pointers to arrays of structures (where we need to rebuild array same way as we rebuild pointers) and enumerate types. That should make simplification of types complete. Neither of those two seems very critical for GCC build, with the patch we are down to 24 duplicated types in bootstrap, I will collect data on firefox, but things looks quite good. (from tens of thousdant week ago).
The patch works, but I am somewhat nervous because modyfing type inplace affects its type_hash_canon_hash and friends. There are pre-existing modifications to function parameters and things seems to just work, but I wonder if we have any strategy on keeping hashes in tree.c consitent across free-lang data? Or are all those hashes unused/freed at this time? lto-bootstrapped/regtested x86_64-linux. Honza * tree.c (free_lang_data_in_type): Simplify types of arrays. Index: tree.c =================================================================== --- tree.c (revision 265877) +++ tree.c (working copy) @@ -5320,6 +5320,8 @@ free_lang_data_in_type (tree type, struc TREE_PURPOSE (p) = NULL; } } + else if (TREE_CODE (type) == ARRAY_TYPE) + TREE_TYPE (type) = fld_simplified_type (TREE_TYPE (type), fld); else if (RECORD_OR_UNION_TYPE_P (type)) { /* Remove members that are not FIELD_DECLs from the field list