This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] don't bzero->memset if cfun is memset


> 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;
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]