public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tom at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/14799] [tree-ssa] convert a sequence of "if"s to a "switch" statement
Date: Fri, 14 Jan 2011 15:54:00 -0000	[thread overview]
Message-ID: <bug-14799-4-2uptw7hJ7Z@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-14799-4@http.gcc.gnu.org/bugzilla/>

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

Tom de Vries <tom at codesourcery dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tom at codesourcery dot com

--- Comment #3 from Tom de Vries <tom at codesourcery dot com> 2011-01-14 15:45:56 UTC ---
The example from the description field looks like this at tree level (optimized
dump with 4.5.1). It takes until late in the rtl untill the duplicate call
blocks are collapsed.
...
foo (int a)
{
<bb 2>:
  if (a_1(D) == 30)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 3>:
  bar (); [tail call]
  goto <bb 10>;

<bb 4>:
  if (a_1(D) == 31)
    goto <bb 5>;
  else
    goto <bb 6>;

<bb 5>:
  bar (); [tail call]
  goto <bb 10>;

<bb 6>:
  if (a_1(D) == 53)
    goto <bb 7>;
  else
    goto <bb 8>;

<bb 7>:
  bar (); [tail call]
  goto <bb 10>;

<bb 8>:
  if (a_1(D) == 23)
    goto <bb 9>;
  else
    goto <bb 10>;

<bb 9>:
  bar (); [tail call]

<bb 10>:
  return;
}
...

If the duplicate blocks would have been collapsed, it would look like this:
...
foo (int a)
{
<bb 2>:
  if (a_1(D) == 30)
    goto <bb 9>;
  else
    goto <bb 4>;

<bb 4>:
  if (a_1(D) == 31)
    goto <bb 9>;
  else
    goto <bb 6>;

<bb 6>:
  if (a_1(D) == 53)
    goto <bb 9>;
  else
    goto <bb 8>;

<bb 8>:
  if (a_1(D) == 23)
    goto <bb 9>;
  else
    goto <bb 10>;

<bb 9>:
  bar (); [tail call]

<bb 10>:
  return;
}
...
for this representation, the patch from PR 46935 comment 5 should work.


       reply	other threads:[~2011-01-14 15:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-14799-4@http.gcc.gnu.org/bugzilla/>
2011-01-14 15:54 ` tom at codesourcery dot com [this message]
2020-12-01 10:47 ` cvs-commit at gcc dot gnu.org
2020-12-01 10:52 ` marxin at gcc dot gnu.org
2004-03-31 11:24 [Bug optimization/14799] New: " kazu at cs dot umass dot edu
2004-05-24 19:41 ` [Bug tree-optimization/14799] " pinskia 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-14799-4-2uptw7hJ7Z@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).