This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] Fix compilation time explosion in contains_label_p
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 28 Jun 2009 14:17:29 +0200
- Subject: Re: [Patch] Fix compilation time explosion in contains_label_p
- References: <200906281010.04695.ebotcazou@adacore.com>
On Sun, Jun 28, 2009 at 10:10 AM, Eric Botcazou<ebotcazou@adacore.com> wrote:
> Hi,
>
> the attached testcase (with -gnato) triggers a compilation time explosion in
> contains_label_p because the tree passed to it contains many shared nodes,
> which are then walked multiple time.
>
> Tested on i586-suse-linux, OK for mainline?
Isn't
- return (walk_tree (&st, contains_label_1 , NULL, NULL) != NULL_TREE);
+ bool ret;
+ struct pointer_set_t *visited = pointer_set_create ();
+ ret = (walk_tree (&st, contains_label_1, NULL, visited) != NULL_TREE);
+ pointer_set_destroy (visited);
+ return ret;
this just the same as using walk_tree_without_duplicates?
Ok with that change.
Thanks,
Richrd.
>
> 2009-06-28 ?Eric Botcazou ?<ebotcazou@adacore.com>
>
> ? ? ? ?* fold-const.c: Include pointer-set.h.
> ? ? ? ?(contains_label_p): Do not walk trees multiple time.
> ? ? ? ?* Makefile.in (fold-const.o): Add dependency on pointer-set.h.
>
>
> 2009-06-28 ?Eric Botcazou ?<ebotcazou@adacore.com>
>
> ? ? ? ?* gnat.dg/overflow_sum2.adb: New test
> ? ? ? ?* gnat.dg/namet.ads: New helper.
>
>
> --
> Eric Botcazou
>