On Thu, Mar 21, 2019 at 09:35:07AM +0100, Richard Biener wrote: > LGTM - any reason you only sometimes conditionalize add_tree_to_fld_list > on the fld->pset.add () result? IMHO consistency should win over > micro-optimizing the case you know the type will not be in the set.
Yeah, it was a optimization for the most common case, when find_decls_types_r calls add_tree_to_fld_list (t, fld); for DECL_P as well as TYPE_P, because in that case the fld->pset.add check has been done already by walk_tree. If we have hundreds thousands of elts in the hash_set, it could be more than a microoptimization, but if you think strongly that it should be all thrown away and add_tree_to_fld_list should start with if (fld->pset.add (t)) return; then I can do that too. > > 2019-03-20 Jan Hubicka <hubi...@ucw.cz> > > Jakub Jelinek <ja...@redhat.com> > > > > PR lto/89692 > > * tree.c (fld_type_variant): Call fld->pset.add. > > (fld_incomplete_type_of): Likewise and don't call add_tree_to_fld_list > > if it returns true. > > (fld_process_array_type): Likewise. > > (free_lang_data_in_type): Purge non-marked types from TYPE_NEXT_VARIANT > > list. > > (find_decls_types_r): Call fld_worklist_push for TYPE_CANONICAL (t). > > > > * g++.dg/other/pr89692.C: New test. Jakub