On 11/9/20 7:24 AM, Martin Liška wrote:
> Hello.
>
> As mentioned in the PR, we used to prefer BT over JT in switch expansion.
> I restore the behavior to that.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?
> Thanks,
> Martin
>
> gcc/ChangeLog:
>
>     PR tree-optimization/97736
>     * tree-switch-conversion.c
> (switch_decision_tree::analyze_switch_statement):
>     Prefer bit tests.
>
> gcc/testsuite/ChangeLog:
>
>     PR tree-optimization/97736
>     * gcc.dg/tree-ssa/switch-1.c: Prefer bit tests.
>     * g++.dg/tree-ssa/pr97736.C: New test.

[ ... ]


> ---
> diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
> index 426462e856b..a7c5df31743 100644
> --- a/gcc/tree-switch-conversion.c
> +++ b/gcc/tree-switch-conversion.c
> @@ -1743,8 +1743,8 @@ switch_decision_tree::analyze_switch_statement ()
>  
>    reset_out_edges_aux (m_switch);
>  
> -  /* Find jump table clusters.  */
> -  vec<cluster *> output = jump_table_cluster::find_jump_tables
> (clusters);
> +  /* Find bit-test clusters.  */
> +  vec<cluster *> output = bit_test_cluster::find_bit_tests (clusters);
>  
>    /* Find bit test clusters.  */

                ^^^


Doesn't the "bit test clusters" need to change too?  OK with that nit fixed.



jeff

Reply via email to