https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110742
--- Comment #13 from CVS 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:9a8782e63790842d1bfa03e12eecf73c4aaeb1f8 commit r14-2697-g9a8782e63790842d1bfa03e12eecf73c4aaeb1f8 Author: Richard Biener <rguent...@suse.de> Date: Thu Jul 20 13:09:17 2023 +0200 tree-optimization/110742 - fix latent issue with permuting existing vectors When we materialize a layout we push edge permutes to constant/external defs without checking we can actually do so. For externals defined by vector stmts rather than scalar components we can't. PR tree-optimization/110742 * tree-vect-slp.cc (vect_optimize_slp_pass::get_result_with_layout): Do not materialize an edge permutation in an external node with vector defs. (vect_slp_analyze_node_operations_1): Guard purely internal nodes better. * g++.dg/torture/pr110742.C: New testcase.