public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "arthur.j.odwyer at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/48732] New: Nested loops with small iteration count gobble time in "tree reassociation"
Date: Fri, 22 Apr 2011 19:10:00 -0000	[thread overview]
Message-ID: <bug-48732-4@http.gcc.gnu.org/bugzilla/> (raw)

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

           Summary: Nested loops with small iteration count gobble time in
                    "tree reassociation"
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: arthur.j.odwyer@gmail.com


Created attachment 24076
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24076
Output of "gcc-4.5 -w -O1 -S test.c -Q -v"

The following test case takes inordinately long to compile on my machine
(Ubuntu 10.10, 64-bit), starting with gcc-4.5.

cat >test.c <<EOF
void func_47()
{
  int a, b, c, d, e;
  for (a=0; a < 8; ++a) {
    for (b=0; b < 8; ++b) {
      for (c=0; c < 8; ++c) {
        for (d=0; d < 8; ++d) {
          int l_752[8];
          int j;
          for (j = 0; j < 8; j++)
            l_752[j] = 0;
        }
      }
    }
  }
}
EOF
time gcc -w -O1 -S test.c -Q

On my machine, the timings are as follows:
With gcc-4.4: real 0.027s
With gcc-4.5: real 5.801s, spent 94% of that time in "tree reassociation"
With trunk:   real 3.567s, spent 77% of that time in "tree reassociation"

The only difference in the assembly output is that gcc-4.4 uses "ret" and
gcc-4.5 uses "rep ret".
Adding a fifth nested loop with 8 iterations makes compilation take more than
300 seconds; I killed it at that point.


             reply	other threads:[~2011-04-22 19:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-22 19:10 arthur.j.odwyer at gmail dot com [this message]
2011-04-23  9:15 ` [Bug tree-optimization/48732] " rguenth at gcc dot gnu.org
2011-04-26 12:17 ` rguenth at gcc dot gnu.org
2014-06-24 10:53 ` 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-48732-4@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).