* [PATCH] Fix bit-test expansion for single cluster (PR tree-optimization/86263).
@ 2018-06-28 19:04 Martin Liška
2018-06-29 7:21 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Martin Liška @ 2018-06-28 19:04 UTC (permalink / raw)
To: gcc-patches, Thomas Schwinge, Tom de Vries
[-- Attachment #1: Type: text/plain, Size: 574 bytes --]
Hi.
I'm sending patch for situation where we create a bit-test for
entire switch. In that case split BB must be redirected so that
the original switch is a dead code.
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
Ready to be installed?
Martin
gcc/ChangeLog:
2018-06-28 Martin Liska <mliska@suse.cz>
PR tree-optimization/86263
* tree-switch-conversion.c (switch_decision_tree::try_switch_expansion):
Make edge redirection.
---
gcc/tree-switch-conversion.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
[-- Attachment #2: 0001-Fix-bit-test-expansion-for-single-cluster-PR-tree-op.patch --]
[-- Type: text/x-patch, Size: 826 bytes --]
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index b79f2fdb6e6..4c9e7b9436b 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -1732,8 +1732,12 @@ switch_decision_tree::try_switch_expansion (vec<cluster *> &clusters)
/* Do not do an extra work for a single cluster. */
if (clusters.length () == 1
&& clusters[0]->get_type () != SIMPLE_CASE)
- clusters[0]->emit (index_expr, index_type,
- gimple_switch_default_label (m_switch), m_default_bb);
+ {
+ cluster *c = clusters[0];
+ c->emit (index_expr, index_type,
+ gimple_switch_default_label (m_switch), m_default_bb);
+ redirect_edge_succ (single_succ_edge (bb), c->m_case_bb);
+ }
else
{
emit (bb, index_expr, default_edge->probability, index_type);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix bit-test expansion for single cluster (PR tree-optimization/86263).
2018-06-28 19:04 [PATCH] Fix bit-test expansion for single cluster (PR tree-optimization/86263) Martin Liška
@ 2018-06-29 7:21 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2018-06-29 7:21 UTC (permalink / raw)
To: mliska; +Cc: GCC Patches, thomas, tdevries
On Thu, Jun 28, 2018 at 9:06 PM Martin Liška <mliska@suse.cz> wrote:
>
> Hi.
>
> I'm sending patch for situation where we create a bit-test for
> entire switch. In that case split BB must be redirected so that
> the original switch is a dead code.
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Ready to be installed?
Testcase?
OK with one added.
Thanks,
Richard.
> Martin
>
> gcc/ChangeLog:
>
> 2018-06-28 Martin Liska <mliska@suse.cz>
>
> PR tree-optimization/86263
> * tree-switch-conversion.c (switch_decision_tree::try_switch_expansion):
> Make edge redirection.
> ---
> gcc/tree-switch-conversion.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-29 7:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-28 19:04 [PATCH] Fix bit-test expansion for single cluster (PR tree-optimization/86263) Martin Liška
2018-06-29 7:21 ` Richard Biener
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).