PATCH cgraphunit.c: Don't revisit SAVE_EXPR nodes
Jan Hubicka
hubicka@ucw.cz
Wed Sep 3 07:26:00 GMT 2003
> I discovered a pathological tree while building libjava with
> -funit-at-a-time that consists of many nested compounds with SAVE_EXPR
> nodes shared on both sides. Seemingly this can cause an exponential
> slowdown in cgraph_create_edges (or "virtual memory exhausted" in my
> case).
>
> walk_tree_without_duplicates would take care of the duplication, except
> when called recursively, as happens at a CALL_EXPR node.
>
> Following is my attempt at a fix. Bootstrapped on mainline
> for i686-pc-linux-gnu.
Looking at the walk_tree_without_duplicates it also uses hash table to
catch such case:
tree
walk_tree_without_duplicates (tree *tp, walk_tree_fn func, void *data)
{
tree result;
htab_t htab;
htab = htab_create (37, htab_hash_pointer, htab_eq_pointer, NULL);
result = walk_tree (tp, func, data, htab);
htab_delete (htab);
return result;
}
So I guess it would be best to allocate hashtable in cgraph_record_edges
and use walk_tree with it instead of walk_tree_without_duplicates.
Would that work, if so would you care to do that? Consider the patch
pre-approved then.
Honza
More information about the Gcc-patches
mailing list