This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Constant fold <string.h> library functions
On Wed, Oct 15, 2003 at 02:45:06PM -0600, Roger Sayle wrote:
> For those worried about the temporary code duplication, I intend to submit
> a follow up patch such that the expand_builtin_foo functions internally
> call the corresponding fold_builtin_foo routines.
Really, I wouldn't think that necessary. I think we can assume
that fold_builtin has been called at some point...
> * builtins.c (fold_builtin_memcpy, fold_builtin_mempcpy,
> fold_builtin_memmove, fold_builtin_strcpy, fold_builtin_strncpy,
> fold_builtin_memcmp, fold_builtin_strcmp, fold_builtin_strncmp):
> New functions.
> (expand_builtin_memcpy): Use integer_zerop instead of testing
> host_integerp and tree_low_cst directly. Move misapplied hunk
> for optimization when SRC and DEST point to the same location.
> (expand_builtin_mempcpy): From here.
> (expand_builtin_memmove): Use integer_zerop instead of testing
> host_integerp and tree_low_cst_directly.
> (expand_builtin_memset): Likewise.
> (expand_builtin_memcmp): Likewise (and for integer_onep).
> (expand_builtin_strncmp): Likewise.
> (fold_builtin): Call the appropriate fold_builtin_foo functions
> to optimize memcpy, mempcpy, memmove, strcpy, strncpy, memcmp,
> strcmp and strncmp.
Ok.
r~