https://gcc.gnu.org/bugzilla/show_bug.cgi?id=29333

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to rsand...@gcc.gnu.org from comment #8)
> This may be worth filing as another PR (let me know if you
> think I should), but another case of VRP stymieing phiopt is:
> 
> void bar (int);
> void
> foo (int a, int b)
> {
>   if (!b)
>     bar (1);
>   else
>     {
>       int c;
>       if (a)
>         c = a;
>       else
>         c = 0;
>       if (c == b)
>         bar (2);
>     }
> }

This was testcase was fixed on trunk by a combo of patches to tree-ssa-phiopt.c
and match.pd (r12-2041, r12-2040, r12-2039, and r12-1152 [there might have been
a few more required which I missed]) which allows early phiopt to change if (a)
c = a else c = 0; to just c = a.

Reply via email to