https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120428
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to fail| |14.3.0, 15.1.0 CC| |liuhongt at gcc dot gnu.org Known to work| |14.2.0 Ever confirmed|0 |1 Component|tree-optimization |target Status|UNCONFIRMED |NEW Summary|[15/16 regression] |[14/15/16 regression] |Suboptimal autovec |Suboptimal autovec |involving blocked |involving blocked |permutation and std::copy |permutation and std::copy Last reconfirmed| |2025-05-27 --- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- The regression was caused by r15-3078-g6ea25c041964bf63014fcf7bb68fb1f5a0a4e123 Align ix86_{move_max,store_max} with vectorizer. When none of mprefer-vector-width, avx256_optimal/avx128_optimal, avx256_store_by_pieces/avx512_store_by_pieces is specified, GCC will set ix86_{move_max,store_max} as max available vector length except for AVX part. if (TARGET_AVX512F_P (opts->x_ix86_isa_flags) && TARGET_EVEX512_P (opts->x_ix86_isa_flags2)) opts->x_ix86_move_max = PVW_AVX512; else opts->x_ix86_move_max = PVW_AVX128; So for -mavx2, vectorizer will choose 256-bit for vectorization, but 128-bit is used for struct copy, there could be a potential STLF issue due to this "misalign". The patch fixes that. gcc/ChangeLog: * config/i386/i386-options.cc (ix86_option_override_internal): set ix86_{move_max,store_max} to PVW_AVX256 when TARGET_AVX instead of PVW_AVX128.