This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Optimize (void) stpcpy (s1, s2) and (void) mempcpy (s1,s2)
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Henderson <rth at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 05 May 2003 09:12:46 -0700
- Subject: Re: [PATCH] Optimize (void) stpcpy (s1, s2) and (void) mempcpy (s1,s2)
- References: <20030505145107.GT16629@sunsite.ms.mff.cuni.cz>
Jakub Jelinek <jakub@redhat.com> writes:
> Hi!
>
> If the result of stpcpy or mempcpy is never used, it is ok to use strcpy
> resp. memcpy instead no matter whether they will be further optimized or
> not.
> Bootstrapped on i686-redhat-linux, no regressions.
> Ok to commit?
>
> 2003-05-05 Jakub Jelinek <jakub@redhat.com>
>
> * builtins.c (expand_builtin_mempcpy): New function.
> (expand_builtin_stpcpy): Optimize stpcpy whose return value is
> ignored into strcpy no matter what arguments it has.
> (expand_builtin) <case BUILT_IN_MEMPCPY>: Call
> expand_builtin_mempcpy.
This is OK, but ...
> * gcc.c-torture/execute/string-opt-18.c (main): Add 3 new tests.
this doesn't appear to test that the optimization actually happens,
can you work out a test that does?
zw