On 10/2/19 5:44 PM, Aaron Sawdey wrote:
> 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 <acsaw...@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.

I stared at this for a bit and came up with a slightly cleaner fix that is one 
less line:

2019-10-03  Aaron Sawdey <acsaw...@linux.ibm.com>

        * expr.c (emit_block_move_hints): Slightly cleaner fix to
        can_move_by_pieces issue.

Index: gcc/expr.c
===================================================================
--- gcc/expr.c  (revision 276516)
+++ gcc/expr.c  (working copy)
@@ -1624,9 +1624,8 @@
       set_mem_size (y, const_size);
     }

-  bool pieces_ok = false;
-  if (CONST_INT_P (size))
-    pieces_ok = can_move_by_pieces (INTVAL (size), align);
+  bool pieces_ok = CONST_INT_P (size)
+    && can_move_by_pieces (INTVAL (size), align);
   bool pattern_ok = false;

   if (!pieces_ok || might_overlap)

Bootstrap/regtest (with --enable-checking=yes,rtl,tree) ok on ppc64le (power9),
committed as obvious.

-- 
Aaron Sawdey, Ph.D.  acsaw...@linux.vnet.ibm.com
050-2/C113  (507) 253-7520 home: 507/263-0782
IBM Linux Technology Center - PPC Toolchain

Reply via email to