https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115538
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:4931a637479aba35e35c50a86f58ecd6262bc487 commit r15-7411-g4931a637479aba35e35c50a86f58ecd6262bc487 Author: Richard Biener <rguent...@suse.de> Date: Fri Feb 7 08:46:31 2025 +0100 tree-optimization/115538 - possible wrong-code with SLP conversion The following fixes a latent issue where we use ranges to verify correctness of a vector conversion optimization. We rely on ranges from 'op0' which for SLP is extracted from the representative stmt which does not necessarily correspond to any actual scalar operation. We also do not verify the range of all scalar lanes in the SLP operand match. The following rectifies this, restricting the support to single-lane SLP nodes at this point - on branches we'd simply not perform this optimization with SLP. PR tree-optimization/115538 * tree-vectorizer.h (vect_get_slp_scalar_def): Declare. * tree-vect-slp.cc (vect_get_slp_scalar_def): New helper. * tree-vect-generic.cc (expand_vector_conversion): Adjust. * tree-vect-stmts.cc (vectorizable_conversion): For SLP correctly look at ranges of the scalar defs of the SLP operand. (supportable_indirect_convert_operation): Likewise.