From: Richard Biener <richard.guenther@gmail.com>
To: "Martin Liška" <mliska@suse.cz>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Expand switch statements with a single (or none) non-default case.
Date: Wed, 30 Aug 2017 12:46:00 -0000 [thread overview]
Message-ID: <CAFiYyc0bNt7Ysumz_ZVXW8uiMpCAfDhPKZatiGMET6rRNiXRtQ@mail.gmail.com> (raw)
In-Reply-To: <bde90963-7695-89d5-6792-e8f803f71160@suse.cz>
On Wed, Aug 30, 2017 at 1:13 PM, Martin Liška <mliska@suse.cz> wrote:
> Hi.
>
> Simple transformation of switch statements where degenerated switch can be interpreted
> as gimple condition (or removed if having any non-default case). I originally though
> that we don't have switch statements without non-default cases, but PR82032 shows we
> can see it.
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Ready to be installed?
While I guess this case is ok to handle here it would be nice if CFG cleanup
would do the same. I suppose find_taken_edge somehow doesn't work for
this case even after my last enhancement? Or is CFG cleanup for some reason
not run?
Richard.
> Martin
>
> gcc/ChangeLog:
>
> 2017-08-25 Martin Liska <mliska@suse.cz>
>
> PR tree-optimization/82032
> * tree-switch-conversion.c (generate_high_low_equality): New
> function.
> (expand_degenerated_switch): Likewise.
> (process_switch): Call expand_degenerated_switch.
> (try_switch_expansion): Likewise.
> (emit_case_nodes): Use generate_high_low_equality.
>
> gcc/testsuite/ChangeLog:
>
> 2017-08-25 Martin Liska <mliska@suse.cz>
>
> PR tree-optimization/82032
> * gcc.dg/tree-ssa/pr68198.c: Update jump threading expectations.
> * gcc.dg/tree-ssa/switch-expansion.c: New test.
> * gcc.dg/tree-ssa/vrp34.c: Update scanned pattern.
> * g++.dg/other/pr82032.C: New test.
> ---
> gcc/testsuite/g++.dg/other/pr82032.C | 36 +++++++
> gcc/testsuite/gcc.dg/tree-ssa/pr68198.c | 6 +-
> gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c | 14 +++
> gcc/testsuite/gcc.dg/tree-ssa/vrp34.c | 5 +-
> gcc/tree-switch-conversion.c | 123 ++++++++++++++++++-----
> 5 files changed, 152 insertions(+), 32 deletions(-)
> create mode 100644 gcc/testsuite/g++.dg/other/pr82032.C
> create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c
>
>
next prev parent reply other threads:[~2017-08-30 12:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-30 12:32 Martin Liška
2017-08-30 12:46 ` Richard Biener [this message]
2017-08-30 13:19 ` Martin Liška
2017-08-30 14:08 ` Richard Biener
2017-09-01 8:07 ` Martin Liška
2017-09-01 8:26 ` Richard Biener
2017-09-01 10:44 ` Martin Liška
2017-09-01 10:57 ` Richard Biener
2017-09-01 13:01 ` Martin Liška
2017-09-04 11:57 ` Richard Biener
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=CAFiYyc0bNt7Ysumz_ZVXW8uiMpCAfDhPKZatiGMET6rRNiXRtQ@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=mliska@suse.cz \
/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).