On 3/9/21 8:40 AM, Jakub Jelinek via Gcc-patches wrote:
> Hi!
>
> Before my PR97690 changes, conditional_replacement would not set neg
> when the nonzero arg was boolean true.
> I've simplified the testing, so that it first finds the zero argument
> and then checks the other argument for all the handled cases
> (1, -1 and 1 << X, where the last case is what the patch added support for).
> But, unfortunately I've placed the integer_all_onesp test first.
> For unsigned precision 1 types such as bool integer_all_onesp, integer_onep
> and integer_pow2p can all be true and the code set neg to true in that case,
> which is undesirable.
>
> The following patch tests integer_pow2p first (which is trivially true
> for integer_onep too and tree_log2 in that case gives shift == 0)
> and only if that isn't the case, integer_all_onesp.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2021-03-09  Jakub Jelinek  <ja...@redhat.com>
>
>       PR tree-optimization/99305
>       * tree-ssa-phiopt.c (conditional_replacement): Test integer_pow2p
>       before integer_all_onesp instead of vice versa.
>
>       * g++.dg/opt/pr99305.C: New test.
OK
jeff

Reply via email to