On Thu, Jun 25, 2020 at 1:07 PM Eric Botcazou <botca...@adacore.com> wrote:
>
> Hi,
>
> ...into bit tests, as done by optimize_range_tests_to_bit_test of the reassoc
> pass.  The patch is aimed at addressing the following two issues:
>
>   1. In order to protect the shift operation from undefinedness, the new bit
> test is guarded with a new test, but this new test uses the range of the bit
> test values, not that of the shift operation so, if the input is in the range
> of the shift operation but not of the bit test values, then the subsequent VRP
> pass cannot eliminate the new test.  Moreover changing the new test to use the
> range of the shift operation, instead of that of the bit test values, in the
> general case would pessimize the cases which are in between.
>
>   2. If the new test can be eliminated, then it becomes profitable to do the
> optimization into a bit test for one fewer comparison in the source code.
>
> Therefore the patch changes optimize_range_tests_to_bit_test to use the range
> info of the input in order to eliminate the new test if possible.
>
> Tested on x86-64/Linux, OK for the mainline?

OK.

Thanks,
Richard.

>
> 2020-06-25  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 in this case.
>
>
> 2020-06-25  Eric Botcazou  <ebotca...@adacore.com>
>
>         * exp_ch4.adb (Expand_Set_Membership): Expand the membership test
>         using left associativity instead of right associativity.
>
>
> 2020-06-25  Eric Botcazou  <ebotca...@adacore.com>
>
>         * gnat.dg/opt86_pkg.ads: New helper.
>         * gnat.dg/opt86a.adb: New test.
>         * gnat.dg/opt86b.adb: Likewise.
>         * gnat.dg/opt86c.adb: Likewise.
>
> --
> Eric Botcazou

Reply via email to