This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH cgraphunit.c: Don't revisit SAVE_EXPR nodes
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Jeff Sturm <jsturm at one-point dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 3 Sep 2003 09:26:07 +0200
- Subject: Re: PATCH cgraphunit.c: Don't revisit SAVE_EXPR nodes
- References: <Pine.LNX.4.44.0309030053090.12689-100000@ops2.one-point.com>
> 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