https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59660
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Last reconfirmed|2014-01-07 00:00:00 |2021-6-1
--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #4)
> > Not all testcases can be handled at gimplification time IIRC. Which
> > means "testcases welcome" first, so we can look at them individually.
>
> The GCC one I saw was equivalent of:
> #include <stdbool.h>
> bool
> m_is_less_than_n (int n, int m)
> {
> return (n==m || m_is_less_than_n (n-1,m));
> }
First we cannot optimize this into a loop until tailc rather than in either
tailr1 or tailr2.
In tailr1, we have:
_2 = m_is_less_than_n (_1, m_7(D));
if (_2 != 0)
goto <bb 6>; [INV]
else
goto <bb 5>; [INV]
<bb 6> :
<bb 5> :
# iftmp.0_3 = PHI <1(6), 0(3), 1(2)>
_12 = (_Bool) iftmp.0_3;
While in tailr2, we have:
_18 = m_is_less_than_n (_17, m_6(D));
_4 = (int) _18;
<bb 7> [local count: 1073741825]:
# iftmp.0_3 = PHI <_4(6), 1(3), 1(2), 1(4), 1(5)>
_8 = (_Bool) iftmp.0_3;
It is not until PRE where we remove the casts (to/from int).