https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115669
--- Comment #12 from GCC Commits ---
The releases/gcc-12 branch has been updated by Richard Biener
:
https://gcc.gnu.org/g:882f7e53a7664f2c76b10dc020e720ba9f55f022
commit r12-10894-g882f7e53a7664f2c76b10dc020e720ba9f55f022
Author: Richard Biener
Date: Thu Jun 27 11:26:08 2024 +0200
tree-optimization/115669 - fix SLP reduction association
The following avoids associating a reduction path as that might
get STMT_VINFO_REDUC_IDX out-of-sync with the SLP operand order.
This is a latent issue with SLP reductions but now easily exposed
as we're doing single-lane SLP reductions.
When we achieved SLP only we can move and update this meta-data.
PR tree-optimization/115669
* tree-vect-slp.cc (vect_build_slp_tree_2): Do not reassociate
chains that participate in a reduction.
* gcc.dg/vect/pr115669.c: New testcase.
(cherry picked from commit 7886830bb45c4f5dca0496d4deae9a45204d78f5)