[Bug tree-optimization/87355] missed comparison optimizations (grep DFA, x86-64)
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Dec 25 12:02:47 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87355
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2021-12-25
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
for f, if GCC would swap around the conditional, we would get decent code.
That is like this:
int f1 (int n, int i)
{
if (n == THRESHOLD)
return i;
if (n >= THRESHOLD)
return 0;
return -1;
}
If we have:
<bb 2> [local count: 1073741823]:
if (n_3(D) > 99)
goto <bb 3>; [96.19%]
else
goto <bb 5>; [3.81%]
<bb 3> [local count: 1032832263]:
if (n_3(D) == 100)
goto <bb 5>; [34.00%]
else
goto <bb 4>; [66.00%]
<bb 4> [local count: 681669290]:
<bb 5> [local count: 1073741824]:
# _1 = PHI <0(4), -1(2), i_4(D)(3)>
We should notice that the conditional at bb 3 is independent and that swapping
would get us a PHI which has 0, -1 which can then be phiopt'ed.
More information about the Gcc-bugs
mailing list