From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7247 invoked by alias); 29 Jan 2013 15:38:46 -0000 Received: (qmail 5624 invoked by uid 48); 29 Jan 2013 15:38:27 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/56113] out of memory when compiling a function with many goto labels (50k > ) Date: Tue, 29 Jan 2013 15:38:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: alias, compile-time-hog, memory-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-01/txt/msg02660.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56113 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jsm28 at gcc dot gnu.org --- Comment #14 from Richard Biener 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.