public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "steven at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/42963]  New: [4,5 Regression] Redundant switch labels not cleaned up anymore
Date: Thu, 04 Feb 2010 23:22:00 -0000	[thread overview]
Message-ID: <bug-42963-280@http.gcc.gnu.org/bugzilla/> (raw)

Test case is taken from bug 18046:
-----------------------------------------------------
extern void foo (void);
extern int i;
void
bar (void)
{
  switch (i)
    {
    case 0:
      foo ();
      break;
    case 1:
      break;
    }


  switch (i)
    {
    case 0:
      foo ();
      break;
    case 1:
      break;
    }
}
-----------------------------------------------------


the .012t.cfg dump with trunk (r156492) today looks like this:

bar ()
{
  int i.0;

<bb 2>:
  i.0 = i;
  switch (i.0) <default: <L2>, case 0: <L0>, case 1: <L2>>

<L0>:
  foo ();

<L2>:
  i.0 = i;
  switch (i.0) <default: <L6>, case 0: <L4>, case 1: <L6>>

<L4>:
  foo ();

<L6>:
  return;

}



The dump with "gcc (Debian 4.3.4-5) 4.3.4" looks better:

bar ()
{
  int i.0;

  # BLOCK 2
  # PRED: ENTRY (fallthru)
  i.0 = i;
  switch (i.0)
    {
      case 0: goto <L0>;
      default : goto <L1>;
    }
  # SUCC: 3 4

  # BLOCK 3
  # PRED: 2
<L0>:;
  foo ();
  # SUCC: 4 (fallthru)

  # BLOCK 4
  # PRED: 2 3 (fallthru)
<L1>:;
  i.0 = i;
  switch (i.0)
    {
      case 0: goto <L4>;
      default : goto <L5>;
    }
  # SUCC: 5 6

  # BLOCK 5
  # PRED: 4
<L4>:;
  foo ();
  # SUCC: 6 (fallthru)

  # BLOCK 6
  # PRED: 4 5 (fallthru)
<L5>:;
  return;
  # SUCC: EXIT

}


Note how GCC 4.5 fails to clean up  the "case 1" label.  The label is retained
all the way through the .137t.nrv dump (at -O2) and only disappears in the
.139t.optimized dump.

This confuses things in a couple of places and costs memory for no reason.


-- 
           Summary: [4,5 Regression] Redundant switch labels not cleaned up
                    anymore
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: steven at gcc dot gnu dot org


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


             reply	other threads:[~2010-02-04 23:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-04 23:22 steven at gcc dot gnu dot org [this message]
2010-02-05 10:15 ` [Bug tree-optimization/42963] [4.5 " rguenth at gcc dot gnu dot org
2010-03-19 16:55 ` matz at gcc dot gnu dot org
2010-04-01 13:51 ` steven at gcc dot gnu dot org
2010-04-06 11:27 ` rguenth at gcc dot gnu dot org
2010-04-13 21:23 ` [Bug tree-optimization/42963] [4.5/4.6 " steven at gcc dot gnu dot org
2010-04-14 14:52 ` matz at gcc dot gnu dot org
2010-04-14 14:53 ` [Bug tree-optimization/42963] [4.5 " matz at gcc dot gnu dot 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-42963-280@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).