[Bug middle-end/56888] memcpy implementation optimized as a call to memcpy

rguenther at suse dot de gcc-bugzilla@gcc.gnu.org
Wed Oct 2 08:59:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56888

--- Comment #23 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 2 Oct 2013, bernd.edlinger at hotmail dot de wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56888
> 
> --- Comment #22 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
> (In reply to Richard Biener from comment #21)
> > -fno-tree-loop-distribute-patterns is the reliable way to not transform loops
> > into library calls.
> 
> Thanks!
> 
> Adding this fixed the generated code:
> 
> #pragma GCC optimize ("no-tree-loop-distribute-patterns")
> 
> BTW their memset.c looks like this:
> 
> externC void *
> memset( void *s, int c, size_t n ) __attribute__ ((weak, alias("_memset")));
> 
> void *
> _memset( void *s, int c, size_t n )
> {
>   while (...)
> }

I suspect this is the most common form - glibc also uses aliases but
IIRC they are using global asms for them :/

The above would be still detectable with the new symbol table / alias
handling in GCC 4.9 (and maybe 4.8, I'm not sure).  So it may be
worth special-casing the "direct recursion" case as a QOI measure.



More information about the Gcc-bugs mailing list