On Mon, Dec 7, 2020 at 3:53 PM Eric Botcazou <botca...@adacore.com> wrote:
>
> Hi,
>
> the very recent addition of the if_to_switch pass has partially disabled the
> optimization I added back in June:
>
> 2020-06-26  Eric Botcazou  <ebotca...@adacore.com>
>
>         * tree-ssa-reassoc.c (dump_range_entry): New function.
>         (debug_range_entry): New debug function.
>         (update_range_test): Invoke dump_range_entry for dumping.
>         (optimize_range_tests_to_bit_test): Merge the entry test in the
>         bit test when possible and lower the profitability threshold.
>
> as witnessed by the 3 new failures in the gnat.dg testsuite.  It turns out
> that both tree-ssa-reassoc.c and tree-switch-conversion.c can turn things into
> bit tests so the optimization must also be added to bit_test_cluster::emit.
>
> The patch also contains a secondary optimization, whereby the full bit-test
> sequence is sent to the folder before being gimplified in case there is only
> one test, so that the most optimized sequence (bt + jc on x86) can be emitted
> like with optimize_range_tests_to_bit_test.
>
> Bootstrapped/regtested on x86-64/Linux, OK for the mainline?

OK.

Richard.

>
> 2020-12-07  Eric Botcazou  <ebotca...@adacore.com>
>
>         PR tree-optimization/96344
>         * tree-switch-conversion.c (bit_test_cluster::emit): Compute the
>         range only if an entry test is necessary.  Merge the entry test in
>         the bit test when possible.  Use PREC local variable consistently.
>         When there is only one test, do a single gimplification at the end.
>
> --
> Eric Botcazou

Reply via email to