https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121096
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by H.J. Lu <h...@gcc.gnu.org>: https://gcc.gnu.org/g:881df7a0b1e8e8c1454309fe23c0edd026296b8b commit r16-3460-g881df7a0b1e8e8c1454309fe23c0edd026296b8b Author: H.J. Lu <hjl.to...@gmail.com> Date: Thu Aug 28 17:55:46 2025 -0700 x86: Allow by_pieces op when expanding memcpy/memset epilogue Since commit 401199377c50045ede560daf3f6e8b51749c2a87 Author: H.J. Lu <hjl.to...@gmail.com> Date: Tue Jun 17 10:17:17 2025 +0800 x86: Improve vector_loop/unrolled_loop for memset/memcpy uses move_by_pieces and store_by_pieces to expand memcpy/memset epilogue with vector_loop even when targetm.use_by_pieces_infrastructure_p returns false, which triggers gcc_assert (targetm.use_by_pieces_infrastructure_p (len, align, memsetp ? SET_BY_PIECES : STORE_BY_PIECES, optimize_insn_for_speed_p ())); in store_by_pieces. Fix it by: 1. Add by_pieces_in_use to machine_function to indicate that by_pieces op is currently in use. 2. Set and clear by_pieces_in_use when expanding memcpy/memset epilogue with move_by_pieces and store_by_pieces. 3. Define TARGET_USE_BY_PIECES_INFRASTRUCTURE_P to return true if by_pieces_in_use is true. gcc/ PR target/121096 * config/i386/i386-expand.cc (expand_cpymem_epilogue): Set and clear by_pieces_in_use when using by_pieces op. (expand_setmem_epilogue): Likewise. * config/i386/i386.cc (ix86_use_by_pieces_infrastructure_p): New. (TARGET_USE_BY_PIECES_INFRASTRUCTURE_P): Likewise. * config/i386/i386.h (machine_function): Add by_pieces_in_use. gcc/testsuite/ PR target/121096 * gcc.target/i386/memcpy-strategy-14.c: New test. * gcc.target/i386/memcpy-strategy-15.c: Likewise. * gcc.target/i386/memset-strategy-10.c: Likewise. * gcc.target/i386/memset-strategy-11.c: Likewise. * gcc.target/i386/memset-strategy-12.c: Likewise. * gcc.target/i386/memset-strategy-13.c: Likewise. * gcc.target/i386/memset-strategy-14.c: Likewise. * gcc.target/i386/memset-strategy-15.c: Likewise. Signed-off-by: H.J. Lu <hjl.to...@gmail.com>