This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] don't bzero->memset if cfun is memset
- From: DJ Delorie <dj at redhat dot com>
- To: mark at codesourcery dot com
- Cc: geoffk at geoffk dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 11 Jul 2002 17:50:17 -0400
- Subject: Re: [patch] don't bzero->memset if cfun is memset
- References: <74140000.1026423389@warlock.codesourcery.com>
> Simply put, this patch is wrong. The checks should include, at least,
> that the function has no DECL_CONTEXT and that it is TREE_PUBLIC. (A
> "static" memset is not *that* memset.)
If you're compiling a static memset, you still can't call the other
memset from within it - it will still resolve to the current function
and recurse.
> You also need to check the type; in C++ I might have a memset of
> twelve arguments in additon to the ordinary one.
In C++, current_function_name isn't "memset" - it's the mangled name,
prettified.
> And it seems to me that maybe the compiler shouldn't be doing this
> at all.
If the user is creating a function called memset and calls bzero
within it, I can't see how gcc could think they want bzero to be
replaced with a call to memset - it's nonsensical and will always
result in recursion. IMHO, in this context the optimization is simply
not valid.