https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108970
--- Comment #2 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:85203d52bfa4a84da5f50e0a242891308ffa8d83 commit r13-6386-g85203d52bfa4a84da5f50e0a242891308ffa8d83 Author: Richard Biener <rguent...@suse.de> Date: Wed Mar 1 09:10:19 2023 +0100 tree-optimization/108970 - ICE with vectorizer peeling The function slpeel_can_duplicate_loop_p fails to verify we can copy blocks, instead slpeel_tree_duplicate_loop_to_edge_cfg does but that's too late. The following fixes this, also simplifying error reporting which is somewhat pointless if we ICE immediately. PR tree-optimization/108970 * tree-vect-loop-manip.cc (slpeel_can_duplicate_loop_p): Check we can copy the BBs. (slpeel_tree_duplicate_loop_to_edge_cfg): Avoid redundant check. (vect_do_peeling): Streamline error handling. * gcc.dg/pr108970.c: New testcase.