public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: Richard Biener <richard.guenther@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Jan Hubicka <hubicka@ucw.cz>, Martin Jambor <mjambor@suse.cz>
Subject: Re: [PATCH][RFC] Make expansion of balanced binary trees of switches on tree level.
Date: Thu, 10 Aug 2017 08:54:00 -0000	[thread overview]
Message-ID: <b128c77b-16d3-d73d-fa6d-f517171ffff4@suse.cz> (raw)
In-Reply-To: <CAFiYyc04cS6qBcReZqx77_=sLw99gfYEPC7YFMsYpOoRRrZxWQ@mail.gmail.com>

On 08/02/2017 01:51 PM, Richard Biener wrote:
> On Wed, Aug 2, 2017 at 1:20 PM, Martin Liška <mliska@suse.cz> wrote:
>> Hello.
>>
>> After some discussions with Honza, I've decided to convert current code in stmt.c that
>> is responsible for switch expansion. More precisely, I would like to convert the code
>> to expand gswitch statements on tree level. Currently the newly created pass is executed
>> at the end of tree optimizations.
>>
>> My plan for future is to inspire in [1] and come up with some more sophisticated switch
>> expansions. For that I've been working on a paper where I'll summarize statistics based
>> on what I've collected in openSUSE distribution with specially instrumented GCC. If I'll be
>> happy I can also fit in to schedule of this year's Cauldron with a talk.
>>
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>
>> Thoughts?
> 
> First of all thanks.
> 
> I think part of switch expansion moved to switch-conversion some time ago
> (emit_case_bit_tests).  So maybe the full lowering should be in at least
> the same source file and it should maybe applied earlier for a subset of
> cases (very low number of cases for example).

Hello.

Agree! Eventually we should merge both files into a single one. I would prefer to start
with new generic name of file (gimple-switch-low.c), which will eventually eat content
of tree-switch-conversion.c. Is it acceptable approach?

As Jeff already accepted the patch, I will install it as soon as an agreement in the question
will be done.

Martin

> 
> Did you base the code on the RTL expansion code or did you re-write it from
> scratch?
> 
> No further comments sofar.
> 
> Richard.
> 
>> Martin
>>
>> [1] https://www.nextmovesoftware.com/technology/SwitchOptimization.pdf
>>
>> gcc/ChangeLog:
>>
>> 2017-07-31  Martin Liska  <mliska@suse.cz>
>>
>>         * Makefile.in: Add gimple-switch-low.o.
>>         * passes.def: Include pass_lower_switch.
>>         * stmt.c (dump_case_nodes): Remove and move to
>>         gimple-switch-low.c.
>>         (case_values_threshold): Likewise.
>>         (expand_switch_as_decision_tree_p): Likewise.
>>         (emit_case_decision_tree): Likewise.
>>         (expand_case): Likewise.
>>         (balance_case_nodes): Likewise.
>>         (node_has_low_bound): Likewise.
>>         (node_has_high_bound): Likewise.
>>         (node_is_bounded): Likewise.
>>         (emit_case_nodes): Likewise.
>>         * timevar.def: Add TV_TREE_SWITCH_LOWERING.
>>         * tree-pass.h: Add make_pass_lower_switch.
>>         * gimple-switch-low.c: New file.
>>
>> gcc/testsuite/ChangeLog:
>>
>> 2017-07-31  Martin Liska  <mliska@suse.cz>
>>
>>         * gcc.dg/tree-prof/update-loopch.c: Scan patterns in
>>         switchlower.
>>         * gcc.dg/tree-ssa/vrp104.c: Likewise.
>> ---
>>  gcc/Makefile.in                                |    1 +
>>  gcc/gimple-switch-low.c                        | 1226 ++++++++++++++++++++++++
>>  gcc/passes.def                                 |    1 +
>>  gcc/stmt.c                                     |  861 -----------------
>>  gcc/testsuite/gcc.dg/tree-prof/update-loopch.c |   10 +-
>>  gcc/testsuite/gcc.dg/tree-ssa/vrp104.c         |    2 +-
>>  gcc/timevar.def                                |    1 +
>>  gcc/tree-pass.h                                |    1 +
>>  8 files changed, 1236 insertions(+), 867 deletions(-)
>>  create mode 100644 gcc/gimple-switch-low.c
>>
>>

  parent reply	other threads:[~2017-08-10  7:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02 11:20 Martin Liška
2017-08-02 11:51 ` Richard Biener
2017-08-02 12:49   ` Martin Liška
2017-08-03  9:02     ` Jan Hubicka
2017-08-03 16:11       ` Jeff Law
2017-08-03 12:22   ` Steven Bosscher
2017-08-10  8:54   ` Martin Liška [this message]
2017-08-14  9:26     ` Richard Biener
2017-08-15 12:50       ` Martin Liška
2017-08-18 10:29         ` Richard Biener
2017-08-18 11:05           ` Martin Liška
2017-08-24 17:21             ` Martin Liška
2017-08-29 12:58               ` Richard Biener
2017-08-29 15:11                 ` Martin Liška
2017-08-30  9:18                   ` Rainer Orth
2017-08-30 12:29                     ` Martin Liška
2018-03-25 10:12                       ` [testsuite, committed] Make scan pattern more precise in vrp104.c Tom de Vries
2017-08-02 13:38 ` [PATCH][RFC] Make expansion of balanced binary trees of switches on tree level David Malcolm
2017-08-03 12:52 ` Steven Bosscher
2017-08-03 12:56   ` Richard Biener
2017-08-03 13:20     ` Jan Hubicka
2017-08-03 13:28     ` Steven Bosscher
2017-08-04 11:19       ` Martin Liška
2017-08-04 11:19   ` Martin Liška

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=b128c77b-16d3-d73d-fa6d-f517171ffff4@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=mjambor@suse.cz \
    --cc=richard.guenther@gmail.com \
    /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).