public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/58315] [4.8/4.9/5 Regression] Excessive memory use with -g Date: Tue, 24 Feb 2015 09:18:00 -0000 [thread overview] Message-ID: <bug-58315-4-Q3uCmxxNUr@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-58315-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58315 --- Comment #20 from rguenther at suse dot de <rguenther at suse dot de> --- On Mon, 23 Feb 2015, aldyh at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58315 > > Aldy Hernandez <aldyh at gcc dot gnu.org> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > CC| |jason at gcc dot gnu.org, > | |rguenth at gcc dot gnu.org > > --- Comment #16 from Aldy Hernandez <aldyh at gcc dot gnu.org> --- > Among other things (because I'm not 100% sure this is the only thing wrong > here) we seem to be generating and awful lot of GIMPLE_DEBUG statements, even > for intermediate values we will throw away. > > I am not sure whether this is just a very inefficient testcase, a byproduct of > the way we expand expressions, or the myriad of DEBUG statements we create. > > For instance, in a snippet of the testcase: > > Variable A(0); > Variable B(1); > Variable C(2); > Variable D(3); > Constraint_System cs; > > cs.insert(Coefficient("2251799813685248")*A > >= Coefficient("-5895288448651847")); > cs.insert(Coefficient("5895288437392848")*A > + Coefficient("3643488632714799")*B > - Coefficient("2251799813685248")*C > >= Coefficient("-19077554137963492")); > ... > > ...we create a temporary instance for each Coefficient constructor call, as > well as a temporary instance for the result of the '*' and '>=' operators, and > a temporary instance for the conversion of [ABC] to a Linear_Expression. > Basically, we create temporary instances of every class we create along the way > (expected), but unfortunately we then create DEBUG statements for each > destructor call in each temporary variable that was created, particularly for > the `this' pointer which is quite useless for debugging IMO. > > For instance, the result of the ">=" operator gets stored in D.166575, but as > you can see below, there are quite a few DEBUG statements for this temporary > which will never see the light of (debugging) day: > > D.166575 = Parma_Polyhedra_Library::operator>= (&D.166573, &D.166574); > > <bb 7>: > Parma_Polyhedra_Library::Constraint_System::insert (&cs, &D.166575); > > <bb 8>: > # DEBUG this => &D.166575 > # DEBUG D#21 => &D.166575.D.73843 > # DEBUG this => D#21 > # DEBUG D#19 => &D#21->D.67748 > # DEBUG this => D#19 > _1448 = &MEM[(struct Row *)&D.166575].D.66121; > Parma_Polyhedra_Library::Row_Impl_Handler::~Row_Impl_Handler (_1448); > > If you look at the "einline" tree dump, you can see numerous DEBUG statements > for each destructor call: > > MEM[(struct &)&D.166591] ={v} {CLOBBER}; > # DEBUG <L0> => NULL > MEM[(struct &)&D.166591] ={v} {CLOBBER}; > # DEBUG <L0> => NULL > MEM[(struct &)&D.166591] ={v} {CLOBBER}; > # DEBUG <L0> => NULL > D.166591 ={v} {CLOBBER}; > # DEBUG this => &D.166589 > # DEBUG D#20 => &D.166589.D.71066 > # DEBUG this => D#20 > # DEBUG D#19 => &D#20->D.67748 > # DEBUG this => D#19 > _1479 = &MEM[(struct Row *)&D.166589].D.66121; > Parma_Polyhedra_Library::Row_Impl_Handler::~Row_Impl_Handler (_1479); > > ad nauseum. > > These DEBUG statements eventually end up as a multitude of VAR_LOCATION rtl > notes that take an awful lot of memory to process. As I've said, I'm not 100% > this is the problem, but I'm quite suspect. It's true that the temporary object D.166591 cannot be accessed from the debugger (it has no name) but we still create debug stmts for its _address_ - to which the debugger can refer to via named 'this' (from some inline code). But yes, we have multiple such assignments to 'this' at the (possible assembler) location of a single statement which of course doesn't help. Thus we should DCE the debug stmt sequences between real stmts like > D.166591 ={v} {CLOBBER}; > # DEBUG this => &D.166589 > # DEBUG D#20 => &D.166589.D.71066 > # DEBUG this => D#20 > # DEBUG D#19 => &D#20->D.67748 > # DEBUG this => D#19 > _1479 = &MEM[(struct Row *)&D.166589].D.66121; to the following at least ("DSE" actually, based on the actual name of the LHS a debugger might use to refer to the variable) > D.166591 ={v} {CLOBBER}; > # DEBUG D#20 => &D.166589.D.71066 > # DEBUG D#19 => &D#20->D.67748 > # DEBUG this => D#19 > _1479 = &MEM[(struct Row *)&D.166589].D.66121; As to "between stmts" that is because after each 'stepi' in the debugger you reach a new state computed by var-tracking. Intermediate state-transitions are not interesting as long as you preserve the "last" state before the next instruction. Thus in reality you'd want to perform this DCE/DSE right before var-tracking (or during the var-tracking insn scan phase) > Also, it may not be the DEBUG statements at fault, but the inefficiency > of the testcase itself (creating all these objects), in which case, > perhaps we could notice this behavior at var-tracking time, and bail? > Though this sounds like a kludge. Of course the issue is very large and repetitive functions. Thus another idea is to simply split up such functions. If just by making var-tracking work on SESE (or SEME) regions and dealing with the boundaries conservatively. Eventually this can be "hacked" by fake splitting/restoring the CFG around vt_initialize/vt_find_locations/vt_finalize. Maybe easier than to make them work on a CFG region.
next prev parent reply other threads:[~2015-02-24 8:39 UTC|newest] Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-09-04 12:25 [Bug debug/58315] New: [4.8/4.9 " rguenth at gcc dot gnu.org 2013-09-04 12:25 ` [Bug debug/58315] " rguenth at gcc dot gnu.org 2013-09-04 12:26 ` rguenth at gcc dot gnu.org 2013-09-04 12:40 ` rguenth at gcc dot gnu.org 2013-09-11 11:40 ` rguenth at gcc dot gnu.org 2013-10-16 9:51 ` jakub at gcc dot gnu.org 2013-11-22 10:54 ` rguenth at gcc dot gnu.org 2014-05-22 9:03 ` [Bug debug/58315] [4.8/4.9/4.10 " rguenth at gcc dot gnu.org 2014-12-19 13:31 ` [Bug debug/58315] [4.8/4.9/5 " jakub at gcc dot gnu.org 2015-02-19 21:49 ` aldyh at gcc dot gnu.org 2015-02-19 22:52 ` aldyh at gcc dot gnu.org 2015-02-20 8:21 ` rguenth at gcc dot gnu.org 2015-02-20 16:31 ` aldyh at gcc dot gnu.org 2015-02-20 16:58 ` rguenth at gcc dot gnu.org 2015-02-20 17:06 ` rguenth at gcc dot gnu.org 2015-02-20 17:36 ` aldyh at gcc dot gnu.org 2015-02-20 23:10 ` aldyh at gcc dot gnu.org 2015-02-21 3:13 ` aldyh at gcc dot gnu.org 2015-02-23 22:59 ` aldyh at gcc dot gnu.org 2015-02-23 23:01 ` aldyh at gcc dot gnu.org 2015-02-24 7:52 ` aldyh at gcc dot gnu.org 2015-02-24 9:09 ` jakub at gcc dot gnu.org 2015-02-24 9:18 ` rguenther at suse dot de [this message] 2015-02-24 16:32 ` aldyh at redhat dot com 2015-02-24 16:42 ` jakub at gcc dot gnu.org 2015-02-24 17:17 ` aldyh at redhat dot com 2015-02-24 18:19 ` jakub at gcc dot gnu.org 2015-02-24 22:47 ` aoliva at gcc dot gnu.org 2015-02-25 0:36 ` aoliva at gcc dot gnu.org 2015-02-25 10:21 ` rguenth at gcc dot gnu.org 2015-02-25 16:45 ` jason at gcc dot gnu.org 2015-05-27 15:36 ` [Bug debug/58315] [4.8/4.9/5/6 " redflames1003 at gmail dot com 2015-05-27 19:49 ` jason at gcc dot gnu.org 2015-06-09 5:05 ` aoliva at gcc dot gnu.org 2015-06-09 5:14 ` aoliva at gcc dot gnu.org 2015-06-09 5:20 ` [Bug debug/58315] [4.8/4.9/5 " aoliva at gcc dot gnu.org 2015-07-16 9:16 ` [Bug debug/58315] [4.9/5 " rguenth at gcc dot gnu.org 2015-10-07 17:33 ` redflames1003 at gmail dot com 2015-10-10 11:24 ` aoliva at gcc dot gnu.org 2015-10-10 12:06 ` aoliva at gcc dot gnu.org 2015-10-10 12:07 ` aoliva at gcc dot gnu.org 2015-10-13 13:57 ` redflames1003 at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-58315-4-Q3uCmxxNUr@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).