[Bug tree-optimization/99997] Missed optimisation with -Os
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Aug 3 22:37:21 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99997
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|rguenth at gcc dot gnu.org |pinskia at gcc dot gnu.org
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, phi-opt should have done it:
if (_10 != 0)
goto <bb 4>; [50.00%]
else
goto <bb 3>; [50.00%]
<bb 3> [local count: 536870913]:
_3 = page_2(D)->compound_head;
_4 = (_Bool) _3;
_11 = (int) _4;
<bb 4> [local count: 1073741824]:
# iftmp.0_5 = PHI <1(2), _11(3)>
We have code to move the conversion in phiopt but we are not doing it for some
reason:
Take:
bool f(int tf, long unsigned int r)
{
int t = 1;
if (tf)
t = ((r&1)!=0);
return t;
}
bool f2(int tf, long unsigned int r)
{
int t = 1;
bool tt = ((r&1)!=0);
if (tf)
t = tt;
return t;
}
These two functions should produce 100% the same code but they don't.
Mine.
More information about the Gcc-bugs
mailing list