On Tue, 14 Jan 2020, Richard Biener wrote: > On Tue, 14 Jan 2020, Richard Biener wrote: > > > When an alias-set is an already existing subset there is no need > > to re-record its children as childs of the parent. > > > > I noticed this when doing 1/2 as trivial opportunity to squeeze > > back some performance for the non-caching recursion I added. The > > whole thing is still quadratic in the depth of the structure, of course. > > > > Bootstrapped and tested on x86_64-unknown-linux-gnu. > > > > Since I'm curious I'll test a variant which checks the children > > are actually recorded before pushing this ... (OK, maybe I shouldn't > > do this...) > > So I did it. It works but for > > FAIL: gnat.dg/interface2.adb 3 blank line(s) in output > FAIL: gnat.dg/interface2.adb (test for excess errors) > UNRESOLVED: gnat.dg/interface2.adb compilation failed to produce > executable > FAIL: gnat.dg/predicate2_main.adb 3 blank line(s) in output > FAIL: gnat.dg/predicate2_main.adb (test for excess errors) > > which ICE with the adjusted patch below. Ada calls > record_component_aliases itself and eventually too early when > some types are not yet complete? Which would also mean that > subsets could be failed to recorded properly. > > So I'm still inclined to go with the original non-checking patch > unless Eric tells me I'm completely wrong and there isn't a > latent issue in the Ada frontend.
Btw, all the dance the Ada FE performs in relate_alias_sets isn't going to work with LTO unless it is no longer necessary anyways. Oh, and we miss libbacktrace support for GNAT bug boxes, for the above I'd like to know whether its from record_component_aliases calls or calls of record_alias_subset. Richard. > diff --git a/gcc/alias.c b/gcc/alias.c > index 336af4e52a7..0eae5386444 100644 > --- a/gcc/alias.c > +++ b/gcc/alias.c > @@ -1164,10 +1164,15 @@ record_alias_subset (alias_set_type superset, > alias_set_type subset) > superset_entry->has_zero_child = 1; > else > { > - subset_entry = get_alias_set_entry (subset); > if (!superset_entry->children) > superset_entry->children > = hash_map<alias_set_hash, int>::create_ggc (64); > + > + /* Enter the SUBSET itself as a child of the SUPERSET. If it was > + already there we're done. */ > + bool present = superset_entry->children->put (subset, 0); > + > + subset_entry = get_alias_set_entry (subset); > /* If there is an entry for the subset, enter all of its children > (if they are not already present) as children of the SUPERSET. */ > if (subset_entry) > @@ -1182,12 +1187,12 @@ record_alias_subset (alias_set_type superset, > alias_set_type subset) > hash_map<alias_set_hash, int>::iterator iter > = subset_entry->children->begin (); > for (; iter != subset_entry->children->end (); ++iter) > - superset_entry->children->put ((*iter).first, (*iter).second); > + { > + bool cpresent = superset_entry->children->put ((*iter).first, > (*iter).second); > + gcc_assert (!present || cpresent); > + } > } > } > - > - /* Enter the SUBSET itself as a child of the SUPERSET. */ > - superset_entry->children->put (subset, 0); > } > } > > -- Richard Biener <rguent...@suse.de> SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)