[Bug target/121096] [16 Regression] ICE: in store_by_pieces, at expr.cc:1847 with -Os -mtune=... -mstringop-strategy=vector_loop
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121096 H.J. Lu changed: What|Removed |Added Resolution|--- |FIXED Status|WAITING |RESOLVED --- Comment #7 from H.J. Lu --- Fixed.
[Bug target/121096] [16 Regression] ICE: in store_by_pieces, at expr.cc:1847 with -Os -mtune=... -mstringop-strategy=vector_loop
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121096 --- Comment #6 from GCC Commits --- The master branch has been updated by H.J. Lu : https://gcc.gnu.org/g:881df7a0b1e8e8c1454309fe23c0edd026296b8b commit r16-3460-g881df7a0b1e8e8c1454309fe23c0edd026296b8b Author: H.J. Lu 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 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
[Bug target/121096] [16 Regression] ICE: in store_by_pieces, at expr.cc:1847 with -Os -mtune=... -mstringop-strategy=vector_loop
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121096 H.J. Lu changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |hjl.tools at gmail dot com Status|NEW |WAITING --- Comment #5 from H.J. Lu --- Created attachment 62220 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62220&action=edit A patch Try this.
[Bug target/121096] [16 Regression] ICE: in store_by_pieces, at expr.cc:1847 with -Os -mtune=... -mstringop-strategy=vector_loop
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121096 Andrew Pinski changed: What|Removed |Added CC||hjl at gcc dot gnu.org --- Comment #4 from Andrew Pinski --- gcc_assert (targetm.use_by_pieces_infrastructure_p (len, align, memsetp ? SET_BY_PIECES : STORE_BY_PIECES, optimize_insn_for_speed_p ())); I suspect r16-2047-g401199377c5004 . Maybe a disconnect due to the -Os.
[Bug target/121096] [16 Regression] ICE: in store_by_pieces, at expr.cc:1847 with -Os -mtune=... -mstringop-strategy=vector_loop
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121096 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed||2025-08-28 --- Comment #3 from Andrew Pinski --- (In reply to Andrew Pinski from comment #2) > Created attachment 62219 [details] > Shortest testcase > > Fails with `-Os -mstringop-strategy=unrolled_loop -mtune=btver2`. Also fails with just `-Os -mstringop-strategy=vector_loop` .
[Bug target/121096] [16 Regression] ICE: in store_by_pieces, at expr.cc:1847 with -Os -mtune=... -mstringop-strategy=vector_loop
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121096 Andrew Pinski changed: What|Removed |Added Attachment #61879|0 |1 is obsolete|| --- Comment #2 from Andrew Pinski --- Created attachment 62219 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62219&action=edit Shortest testcase Fails with `-Os -mstringop-strategy=unrolled_loop -mtune=btver2`.
[Bug target/121096] [16 Regression] ICE: in store_by_pieces, at expr.cc:1847 with -Os -mtune=... -mstringop-strategy=vector_loop
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121096 Richard Biener changed: What|Removed |Added Target Milestone|--- |16.0 Keywords||needs-bisection
