This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC PATCH] fold one element {mem{set,cpy,pcpy,move},b{zero,copy}} (PR middle-end/27567)
- From: Roger Sayle <roger at eyesopen dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 4 Sep 2006 20:04:25 -0600 (MDT)
- Subject: Re: [RFC PATCH] fold one element {mem{set,cpy,pcpy,move},b{zero,copy}} (PR middle-end/27567)
Hi Jakub,
On Fri, 1 Sep 2006, Jakub Jelinek wrote:
> 2006-09-01 Jakub Jelinek <jakub@redhat.com>
>
> PR middle-end/27567
> * builtins.c (fold_builtin_memcpy, fold_builtin_memmove): Remove.
> (fold_builtin_mempcpy): Rename to...
> (fold_builtin_memory_op): ... this. Optimize one element copy
> into an assignment.
> (fold_builtin_memset, fold_builtin_bzero, fold_builtin_bcopy): New
> functions.
> (expand_builtin_strcpy, expand_builtin_strncpy): Handle COMPOUND_EXPR.
> (expand_builtin_memcpy, expand_builtin_mempcpy,
> expand_builtin_memmove): Likewise. Use fold_builtin_memory_op.
> (fold_builtin_1): Handle BUILT_IN_MEMSET, BUILT_IN_BZERO and
> BUILT_IN_BCOPY. Use fold_builtin_memory_op for
> BUILT_IN_MEM{CPY,PCPY,MOVE}.
Ok, this revised version is OK for mainline. It catches all the cases
where a memset is really just a simple assignment, i.e. those that could
be usefully optimized via tree-ssa. I'm also happier that we leave the
rare/corner cases of unaligned memcpy until RTL expansion which has been
well tested.
Let's see how this behaves on mainline for a while, before deciding on
what to do about PR 27567 on the 4.0 branch.
Thanks again,
Roger
--