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 19:52:19 -0400
- Subject: Re: [patch] don't bzero->memset if cfun is memset
- References: <79480000.1026424806@warlock.codesourcery.com>
> You should at the very least be using DECL_ASSEMBLER_NAME.
Done.
> And, the patch only goes half way anyhow; what about index and
> strchr and other such pairs?
I checked index, rindex, and bcmp, and they don't expand into calls to
the other function - they're either open coded or left as calls to the
original functions. Only bzero is replaced with a regular call to a
different function. I couldn't find any other cases of a function
call being replaced with a different function call.
I couldn't find anywhere in the documentation where it explicitly says
that bzero is replaced with a call to memset, so there's nowhere to
note that it won't always do that.
Here's the current patch.
Index: builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.c,v
retrieving revision 1.153
diff -p -3 -r1.153 builtins.c
*** builtins.c 6 Jul 2002 00:16:41 -0000 1.153
--- builtins.c 11 Jul 2002 23:51:03 -0000
*************** expand_builtin_bzero (exp)
*** 2278,2283 ****
--- 2278,2287 ----
tree dest, size, newarglist;
rtx result;
+ if (strcmp (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (cfun->decl)),
+ "memset") == 0)
+ return NULL_RTX;
+
if (!validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
return NULL_RTX;