https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92811
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-08-03
Ever confirmed|0 |1
Severity|normal |enhancement
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, I this is issue is the following take:
int twice<int (*)(int)>(int (*)(int))::<lambda(int)>::operator() (const struct
._anon_2 * const __closure, int v)
{
int (*<T379>) (int) _1;
int _8;
int _10;
<bb 2> [local count: 1073741824]:
_1 = __closure_5(D)->__f;
_8 = _1 (v_6(D));
_10 = _1 (_8);
return _10;
}
------- CUT -----
IPA-SRA cannot see that the contents of __closure_5(D) cannot change in the
call to _1 so it does nothing.
I wonder if some how devirtualization could do the check and inline and then it
would just follow through.