From: "Martin Liška" <mliska@suse.cz>
To: Richard Biener <richard.guenther@gmail.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
GCC Patches <gcc-patches@gcc.gnu.org>,
Jan Hubicka <hubicka@ucw.cz>
Subject: Re: [PATCH] Add if-chain to switch conversion pass.
Date: Mon, 12 Oct 2020 15:01:59 +0200 [thread overview]
Message-ID: <d1e91d0c-785e-9281-89c7-25f15c3f1027@suse.cz> (raw)
In-Reply-To: <a57a4ae2-1bf4-2e1b-f87a-f9a8dfb628db@suse.cz>
On 10/12/20 2:44 PM, Martin Liška wrote:
> On 10/7/20 10:00 AM, Richard Biener wrote:
>> As said I'd have a BB-local pass over BBs recording the index variable
>> and the range covered by the BBs gcond, plus recording how many excess
>> stmts there are for eventual code motion.
>>
>> Only after that BB-local pass start to group BBs in a walk from dominated to
>> dominating BBs looking for common indexes and building a case vector.
>>
>> The main thing is to avoid repeatedly analyzing BBs conditions (so the first
>> pass could be also a on-demand precompute thing) and making the
>> case vector build optimal.
>
> I have a patch that does that using the infrastructure from tree-ssa-reassoc.
> Now I would like to implement the code hoisting. Am I right that we want
> something like:
>
> if (index == C0)
> goto BB_0;
> else
> {
> BB1_to_hoist_stmts;
> if (index == C1)
> goto BB_1;
> else
> {
> BB2_to_hoist_stmts;
> if (index == C2)
> goto BB_2;
> else
> goto default_BB;
> }
> }
>
> be converted into:
>
> switch(index)
> {
> case C0:
> goto BB_0;
> case C1:
> BB1_to_hoist_stmts;
> goto BB_1;
> case C2:
> BB1_to_hoist_stmts;
> BB2_to_hoist_stmts;
> goto BB_2;
> else:
> BB1_to_hoist_stmts;
> BB2_to_hoist_stmts;
> goto default_BB;
> }
>
> ?
Reading again Richi's comment:
> ifcombine simply hoists any stmts without side-effects up the
> dominator tree and thus only requires BBs without side-effects
> (IIRC there's a predicate fn for that).
we likely want to hoist the statements "up" to the gswitch BB?
Martin
>
> Thanks,
> Martin
next prev parent reply other threads:[~2020-10-12 13:02 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-04 14:23 Martin Liška
2019-11-04 14:49 ` Jakub Jelinek
2019-11-05 12:38 ` Richard Biener
2019-11-06 21:03 ` Bernhard Reutner-Fischer
2019-11-14 9:44 ` Martin Liška
2019-11-14 12:35 ` Bernhard Reutner-Fischer
2019-11-14 9:41 ` Martin Liška
2019-11-14 10:48 ` Richard Biener
2019-11-15 13:56 ` Martin Liška
2020-09-01 11:47 ` Martin Liška
2020-09-01 14:50 ` David Malcolm
2020-09-02 11:53 ` Martin Liška
2020-09-21 8:55 ` Martin Liška
2020-09-24 12:41 ` Richard Biener
2020-09-25 14:05 ` Martin Liška
2020-09-29 8:46 ` Richard Biener
2020-10-02 13:26 ` Martin Liška
2020-10-02 14:19 ` Andrew MacLeod
2020-10-06 12:09 ` Martin Liška
2020-10-06 12:56 ` Andrew MacLeod
2020-10-06 13:09 ` Martin Liška
2020-10-06 13:23 ` Andrew MacLeod
2020-10-06 13:41 ` Richard Biener
2020-10-02 13:23 ` Martin Liška
2020-10-06 7:47 ` Richard Biener
2020-10-06 13:48 ` Martin Liška
2020-10-06 14:12 ` Jakub Jelinek
2020-10-12 12:39 ` Martin Liška
2020-10-12 13:00 ` Jakub Jelinek
2020-10-14 18:09 ` Andrew MacLeod
2020-10-07 8:00 ` Richard Biener
2020-10-12 12:44 ` Martin Liška
2020-10-12 13:01 ` Martin Liška [this message]
2020-10-15 12:38 ` Richard Biener
2020-10-16 14:04 ` [PATCH v2] " Martin Liška
2020-11-06 12:31 ` Richard Biener
2020-11-09 12:26 ` Martin Liška
2020-11-16 12:21 ` Richard Biener
2020-11-18 12:25 ` Martin Liška
2020-11-19 14:46 ` Richard Biener
2020-11-20 8:57 ` Martin Liška
2020-11-20 14:37 ` Richard Biener
2020-11-27 15:07 ` Martin Liška
2020-12-01 10:34 ` Richard Biener
2020-12-01 13:57 ` [PATCH] if-to-switch: Support chain with 2 BBs Martin Liška
2020-12-01 22:14 ` Jeff Law
2019-11-13 11:32 ` [PATCH] Add if-chain to switch conversion pass Martin Liška
2019-11-13 16:14 ` Michael Matz
2019-11-14 10:07 ` 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=d1e91d0c-785e-9281-89c7-25f15c3f1027@suse.cz \
--to=mliska@suse.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
--cc=jakub@redhat.com \
--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).