https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95761
--- Comment #3 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:f8f5715606a4a455327874847ccc91f4617bb4de commit r11-1553-gf8f5715606a4a455327874847ccc91f4617bb4de Author: Richard Biener <rguent...@suse.de> Date: Fri Jun 19 10:03:46 2020 +0200 tree-optimization/95761 - fix vector insertion place compute I missed that indeed SLP permutation code generation can end up refering to a non-last vectorized stmt in the last SLP_TREE_VEC_STMTS element as optimization. So walk them all. 2020-06-19 Richard Biener <rguent...@suse.de> PR tree-optimization/95761 * tree-vect-slp.c (vect_schedule_slp_instance): Walk all vectorized stmts for finding the last one. * gcc.dg/torture/pr95761.c: New testcase.