diff options
author | Richard Biener <rguenther@suse.de> | 2020-01-14 08:48:20 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-01-15 11:43:54 +0100 |
commit | 6c5776676108e36e82b3c4a42156a3937f3dc7f7 (patch) | |
tree | bab6abf5b6d0829ad3b774c98a34479854bf6c1b | |
parent | e2346a33b05871fc065815d4cfd531dfa0195507 (diff) | |
download | gcc-6c5776676108e36e82b3c4a42156a3937f3dc7f7.zip gcc-6c5776676108e36e82b3c4a42156a3937f3dc7f7.tar.gz gcc-6c5776676108e36e82b3c4a42156a3937f3dc7f7.tar.bz2 |
Optimize alias subset recording
When an alias-set is an already existing subset there is no need
to re-record its children as childs of the parent.
2020-01-15 Richard Biener <rguenther@suse.de>
* alias.c (record_alias_subset): Avoid redundant work when
subset is already recorded.
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/alias.c | 11 |
2 files changed, 12 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4da4d04..8ef8577 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2020-01-15 Richard Biener <rguenther@suse.de> + + * alias.c (record_alias_subset): Avoid redundant work when + subset is already recorded. + 2020-01-14 David Malcolm <dmalcolm@redhat.com> * doc/invoke.texi (-fdiagnostics-show-cwe): Add note that some of diff --git a/gcc/alias.c b/gcc/alias.c index 9629b5a..3794f9b 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -1164,10 +1164,16 @@ 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. */ + if (superset_entry->children->put (subset, 0)) + return; + + 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) @@ -1185,9 +1191,6 @@ record_alias_subset (alias_set_type superset, alias_set_type subset) superset_entry->children->put ((*iter).first, (*iter).second); } } - - /* Enter the SUBSET itself as a child of the SUPERSET. */ - superset_entry->children->put (subset, 0); } } |