This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/56113] out of memory when compiling a function with many goto labels (50k > )
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 29 Jan 2013 15:38:24 +0000
- Subject: [Bug middle-end/56113] out of memory when compiling a function with many goto labels (50k > )
- Auto-submitted: auto-generated
- References: <bug-56113-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56113
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jsm28 at gcc dot gnu.org
--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> 2013-01-29 15:38:24 UTC ---
Run till exit from #0 update_label_decls (scope=0x7f32004f6c60)
at /space/rguenther/src/svn/trunk/gcc/c/c-decl.c:1023
takes a long time for n = 50000. Seems to be quadratic (# of scopes
times # of gotos).
Re-writing the function into SSA takes a surprisingly large amount of
memory and compile-time as well. I suppose using a special memory variable
to factor the goto (one without virtual operands) would make this cheaper.
Basically avoid going into SSA for it (avoid the gigantic PHI).
Similar rewrite_into_loop_closed_ssa is slow.
Next is PTA, but we know that already, the amount of extra memory used
is reasonable now. Simple compile-time optimizations seem to be possible
(we do a lot of redundant work in find_what_var_points_to by not caching
the result for the representative).
I have a patch to reduce (n = 10000)
tree PTA : 25.37 (24%) usr 0.03 ( 3%) sys 25.44 (24%) wall
3125 kB ( 1%) ggc
to
tree PTA : 5.06 ( 6%) usr 0.02 ( 2%) sys 5.09 ( 6%) wall
937 kB ( 0%) ggc
leaves
tree SSA incremental : 34.14 (39%) usr 0.00 ( 0%) sys 34.22 (39%) wall
0 kB ( 0%) ggc
as the biggest offender.