This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Fix compilation time explosion in contains_label_p


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
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]