This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Use movmem optab to attempt inline expansion of __builtin_memmove()
- From: Aaron Sawdey <acsawdey at linux dot ibm dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Jeff Law <law at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Biener <richard dot guenther at gmail dot com>, Michael Matz <matz at suse dot de>, Segher Boessenkool <segher at kernel dot crashing dot org>, Bill Schmidt <wschmidt at linux dot ibm dot com>, David Edelsohn <dje dot gcc at gmail dot com>
- Date: Wed, 2 Oct 2019 17:44:04 -0500
- Subject: Re: [PATCH] Use movmem optab to attempt inline expansion of __builtin_memmove()
- References: <85494829-c454-3448-2951-0cc2a36df507@linux.ibm.com> <8351a374-cd11-32c0-ef28-6757c7d142d9@redhat.com> <de5c2e23-6435-698d-c55d-2a8a124ab372@linux.ibm.com> <20191002223548.GO15914@tucnak>
On 10/2/19 5:35 PM, Jakub Jelinek wrote:
> On Wed, Oct 02, 2019 at 09:21:23AM -0500, Aaron Sawdey wrote:
>>>> 2019-09-27 Aaron Sawdey <acsawdey@linux.ibm.com>
>>>>
>>>> * builtins.c (expand_builtin_memory_copy_args): Add might_overlap parm.
>>>> (expand_builtin_memcpy): Use might_overlap parm.
>>>> (expand_builtin_mempcpy_args): Use might_overlap parm.
>>>> (expand_builtin_memmove): Call expand_builtin_memory_copy_args.
>>>> (expand_builtin_memory_copy_args): Add might_overlap parm.
>>>> * expr.c (emit_block_move_via_cpymem): Rename to
>>>> emit_block_move_via_pattern, add might_overlap parm, use cpymem
>>>> or movmem optab as appropriate.
>>>> (emit_block_move_hints): Add might_overlap parm, do the right
>>>> thing for might_overlap==true.
>>>> * expr.h (emit_block_move_hints): Update prototype.
>
>> @@ -1622,13 +1624,30 @@
>> set_mem_size (y, const_size);
>> }
>>
>> - if (CONST_INT_P (size) && can_move_by_pieces (INTVAL (size), align))
>> + bool pieces_ok = can_move_by_pieces (INTVAL (size), align);
>> + bool pattern_ok = false;
>> +
>> + if (!CONST_INT_P (size) || !pieces_ok || might_overlap)
> ...
>
> This change broke rtl checking bootstrap.
> You can't use INTVAL on size that isn't CONST_INT_P.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
> committed to trunk as obvious:
Jakub,
Sorry about that! Now that you point it out, it's obvious. But what it means
for me is that I need to be in the habit of bootstrapping with --enable-checking=rtl
when I make these changes.
Aaron
--
Aaron Sawdey, Ph.D. acsawdey@linux.vnet.ibm.com
050-2/C113 (507) 253-7520 home: 507/263-0782
IBM Linux Technology Center - PPC Toolchain