public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/58479] [4.9 Regression] slow var-tracking on x86_64-linux at -O1 (and above) with -g, but checking disabled
Date: Mon, 20 Jan 2014 10:48:00 -0000	[thread overview]
Message-ID: <bug-58479-4-ol9LdmB3pC@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58479-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58479

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I don't see why do you think nobody would try to look at t[x][y][z] in the
debugger.
Anyway, I think we can do two things here.  Obviously we can't give up on
cunrolling it because that would be a clear -fcompare-debug failure.  But:
1) in loop unrolling, analyze the debug stmts we are about to unroll, and if
some of the debug stmts refer to a decl no other debug stmt in the loop refers
to (though would need to take into account DECL_DEBUG_EXPR overlaps) and the
expression in the debug stmt uses only SSA_NAMEs from before the loop,
constants and/or debug exprs from the loop that satisfy that recursively, just
emit the those debug stmts in the first iteration only and not repeat those in
all the other unrolled iterations
1a) alternatively to that, write some debug stmt optimization pass, that would
detect the case of useless debug stmts (saying something lives in what it is
known to live at from earlier debug stmts already)

2) have some debug stmt limits (--param controlled), above which we start
dropping debug stmts or resetting them just once or something similar.  Because
it is possible that there are multiple debug stmts per the same decl in the
loop and 1) or 1a) can't do anything.  Perhaps have the normal debug stmts in
first iteration of the unrolled loop (or a few of them, depending on how many
there are), then when we give up just reset all the debug stmts in some
iteration and after that iteration and before last iteration don't emit debug
stmts at all, then finally in the last iteration emit debug stmts again.

Testcase for 2) is e.g. -O2 -g:
int a, b, c, d, e;
int
main ()
{
  for (a = 0; a < 16; a++)
  for (b = 0; b < 16; b++)
  for (c = 0; c < 16; c++)
  for (d = 0; d < 16; d++)
  for (e = 0; e < 16; e++)
    {
      int f;
#define F10 f = 0; f = 1; f = 2; f = 3; f = 4; f = 5; f = 6; f = 7; f = 8; f =
9;
#define F100 F10 F10 F10 F10 F10 F10 F10 F10 F10 F10
      F100
    }
  return 0;
}

Another testcase, with no unrolling at all, that shows that it is easy to get
thousands of debug stmts:
int a, b, c, d, e, f;

int
main ()
{
#define F1 {{f, f, f, f, f, f, f, f, f}, {f, f, f, f, f, f, f, f, f}},
#define F10 F1 F1 F1 F1 F1 F1 F1 F1 F1 F1
#define F100 F10 F10 F10 F10 F10 F10 F10 F10 F10 F10
#define F1000 F100 F100 F100 F100 F100 F100 F100 F100 F100 F100
  int t[1000][2][9] = {
    F1000
  };
  return 0;
}

not sure where if at all to put any --param limits here though, after all, you
get for this in the initializers as huge spaghetti code and only later on that
is transformed into no actual code, just DEBUG stmt spaghetti.  Though,
supposedly this last example is already related to the PR59659 patch (which
I've done for C++ only so far).


  parent reply	other threads:[~2014-01-20 10:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-19 19:47 [Bug middle-end/58479] New: slow compilation " su at cs dot ucdavis.edu
2013-09-19 20:03 ` [Bug middle-end/58479] " mpolacek at gcc dot gnu.org
2013-09-19 20:06 ` [Bug middle-end/58479] [4.9 Regression] " mpolacek at gcc dot gnu.org
2013-09-19 20:10 ` mpolacek at gcc dot gnu.org
2014-01-20  9:56 ` [Bug middle-end/58479] [4.9 Regression] slow var-tracking " rguenth at gcc dot gnu.org
2014-01-20 10:48 ` jakub at gcc dot gnu.org [this message]
2014-03-03 14:01 ` jakub at gcc dot gnu.org
2014-03-12 15:28 ` [Bug middle-end/58479] [4.8/4.9 " jakub at gcc dot gnu.org
2014-04-22 11:37 ` [Bug middle-end/58479] [4.8/4.9/4.10 " jakub at gcc dot gnu.org
2014-07-16 13:31 ` jakub at gcc dot gnu.org
2014-10-30 10:42 ` [Bug middle-end/58479] [4.8/4.9/5 " jakub at gcc dot gnu.org
2015-06-26 20:10 ` [Bug middle-end/58479] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:36 ` jakub at gcc dot gnu.org
2021-05-14  9:46 ` [Bug middle-end/58479] [9/10/11/12 " jakub at gcc dot gnu.org
2021-06-01  8:06 ` rguenth at gcc dot gnu.org
2022-05-27  9:34 ` [Bug debug/58479] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:30 ` jakub at gcc dot gnu.org
2023-07-07 10:30 ` [Bug debug/58479] [11/12/13/14 " rguenth at gcc dot gnu.org

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-58479-4-ol9LdmB3pC@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: link
Be 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).