[RFC PATCH] fold one element {mem{set,cpy,pcpy,move},b{zero,copy}} (PR middle-end/27567)

Roger Sayle roger@eyesopen.com
Thu Aug 31 13:15:00 GMT 2006


On Wed, 30 Aug 2006, Jakub Jelinek wrote:
> 2006-08-30  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}.

This is OK for mainline, provided its been boostrapped and regression
tested somewhere, as PR middle-end/27567 is a P2 regression affecting
all open branches.  However, as it's a bit intrusive, and I'm cautious
of corner cases or potential interactions on STRICT_ALIGNMENT targets,
let's leave it a week or two on mainline to confirm there are no problems
before backporting to 4.1 and 4.0.

If you could spin this patch on your build farm, the wide number of
architectures covered would go a long way to easing my concerns.

Many thanks in advance.  Nice patch.

Roger
--



More information about the Gcc-patches mailing list