This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/70140] Inefficient expansion of __builtin_mempcpy
- From: "wilco at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 21 Jul 2017 16:22:44 +0000
- Subject: [Bug middle-end/70140] Inefficient expansion of __builtin_mempcpy
- Auto-submitted: auto-generated
- References: <bug-70140-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70140
--- Comment #11 from Wilco <wilco at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #10)
> > >
> > > Yep, I've noticed. It's strange for me why it's not working. I've just asked
> > > at GCC ML: https://gcc.gnu.org/ml/gcc/2017-07/msg00144.html
> >
> > It's marked as a tailcall so anything you generate afterwards will be
> > ignored:
>
> Thanks, knowing that it was easy to fix ;) I'm going to test the patch and
> will send it to mailing list.
Well the new patch looks great - I tried it on GLIBC and it ends up generating
better code than inlining mempcpy in the string header. In total 111 calls to
mempcpy are turned into memcpy, and although there are 166 extra instructions
(most add/mov to deal with the return value), there are just 12 extra
callee-saves.