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: 2019-10-03 Jakub Jelinek <ja...@redhat.com> PR rtl-optimization/91976 * expr.c (emit_block_move_hints): Don't call can_move_by_pieces if size is not CONST_INT_P, set pieces_ok to false in that case. Simplify CONST_INT_P (size) && pieces_ok to pieces_ok. Formatting fix. --- gcc/expr.c.jj 2019-10-02 16:35:20.977451346 +0200 +++ gcc/expr.c 2019-10-02 21:47:54.900724874 +0200 @@ -1624,16 +1624,18 @@ emit_block_move_hints (rtx x, rtx y, rtx set_mem_size (y, const_size); } - bool pieces_ok = can_move_by_pieces (INTVAL (size), align); + bool pieces_ok = false; + if (CONST_INT_P (size)) + pieces_ok = can_move_by_pieces (INTVAL (size), align); bool pattern_ok = false; - if (!CONST_INT_P (size) || !pieces_ok || might_overlap) + if (!pieces_ok || might_overlap) { - pattern_ok = - emit_block_move_via_pattern (x, y, size, align, - expected_align, expected_size, - min_size, max_size, probable_max_size, - might_overlap); + pattern_ok + = emit_block_move_via_pattern (x, y, size, align, + expected_align, expected_size, + min_size, max_size, probable_max_size, + might_overlap); if (!pattern_ok && might_overlap) { /* Do not try any of the other methods below as they are not safe @@ -1645,7 +1647,7 @@ emit_block_move_hints (rtx x, rtx y, rtx if (pattern_ok) ; - else if (CONST_INT_P (size) && pieces_ok) + else if (pieces_ok) move_by_pieces (x, y, INTVAL (size), align, RETURN_BEGIN); else if (may_use_call && !might_overlap && ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (x)) Jakub