https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123014
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tamar Christina <[email protected]>: https://gcc.gnu.org/g:8aa4ef38bd13c177c24d1d71ac172379b0ec26cb commit r16-6031-g8aa4ef38bd13c177c24d1d71ac172379b0ec26cb Author: Tamar Christina <[email protected]> Date: Thu Dec 11 15:51:23 2025 +0000 vect: only move update_e if edge is split [PR123014] This is an alternative fix for PR122959 where the issue is that in order to maintain LOOPS_HAVE_PREHEADERS slpeel_add_loop_guard may add an empty block that becomes the pre-header edge of the epilog loop. If the epilog loop already had a pre-header we insert nothing and update_e is already pointing to the right thing. However if we do insert the intermediate block we have this situation guard block | pre-header | epilog vect_update_ivs_after_vectorizer now needs to use the guard block to identify the PHI nodes, but use the edge from pre-header -> epilog as the update_e. The first fix moved update_e detection and we picked the guard pre-header -> epilog edge and would use the pre-header block to fill in any new adjustments needed. This doesn't work because due to skip_epilog we have to put all adjustments in the guard block, since the skip_epilog edge also skips the pre-header. This patch instead addresses this in vect_update_ivs_after_vectorizer by if you have an empty pre-header, it moves the edge down through the fall-through edge, but keeps exit_bb as guard block. gcc/ChangeLog: PR tree-optimization/123014 * tree-vect-loop-manip.cc (vect_update_ivs_after_vectorizer): Detect empty pre-header block. (vect_do_peeling): Undo changes from PR122959.
