[Bug tree-optimization/83142] Missed tail-call opportunity

prathamesh3492 at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 28 05:24:00 GMT 2017


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

prathamesh3492 at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |prathamesh3492 at gcc dot gnu.org

--- Comment #1 from prathamesh3492 at gcc dot gnu.org ---
Hi,
I had submitted a patch for a similar case involving __builtin_memcpy:
https://gcc.gnu.org/ml/gcc-patches/2016-11/msg02485.html

IIUC, there was following issue:
Marking it as tailcall at GIMPLE won't necessarily make it a tail-call during
RTL tail-call emission. To address this issue, the patch created artificial lhs
and returned that instead for the tail-call to be in more "natural" form:

_memcpy(dest, src, n)
return dest
to
_1 = memcpy(dest, src, n)
return _1

And I think later it was concluded that this was better handled in FRE/PRE, for
which you had posted a patch:
https://gcc.gnu.org/ml/gcc-patches/2016-12/msg00424.html

Thanks,
Prathamesh


More information about the Gcc-bugs mailing list