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] Optimize memcpy + memset (PR fortran/45636)


On Mon, Oct 11, 2010 at 1:46 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> This patch optimizes
> memcpy (x, "abcd", 4);
> memset (x + 4, ' ', 4);
> sequences into a single
> memcpy (x, "abcd ? ?", 8);
> if it is known (or expected) that the memcpy will be implemented using
> store_by_pieces (otherwise we'd risk enlarging .rodata too much, e.g.
> if there are only few longer string literals in memcpy originally and
> adding too many different memset variants after them would mean the string
> literals couldn't be shared anymore).
> The patch also handles
> memcpy (x, "a", 1);
> memset (x + 1, 'b', 11);
> where the memcpy has been optimized into a store.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2010-10-11 ?Jakub Jelinek ?<jakub@redhat.com>
>
> ? ? ? ?PR fortran/45636
> ? ? ? ?* tree-ssa-forwprop.c: Include expr.h.
> ? ? ? ?(constant_pointer_difference, simplify_builtin_call): New functions.
> ? ? ? ?(tree_ssa_forward_propagate_single_use_vars): Call
> ? ? ? ?simplify_builtin_call on builtin calls.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46461

-- 
H.J.


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