https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114787
--- Comment #19 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:715a1df9082b40cf810283632218258ac9c86773 commit r13-8697-g715a1df9082b40cf810283632218258ac9c86773 Author: Richard Biener <rguent...@suse.de> Date: Wed Apr 24 08:42:40 2024 +0200 tree-optimization/114787 - more careful loop update with CFG cleanup When CFG cleanup removes a backedge we have to be more careful with loop update. In particular we need to clear niter info and estimates and if we remove the last backedge of a loop we have to also mark it for removal to prevent a following basic block merging to associate loop info with an unrelated header. PR tree-optimization/114787 * tree-cfg.cc (remove_edge_and_dominated_blocks): When removing a loop backedge clear niter info and when removing the last backedge of a loop mark that loop for removal. * gcc.dg/torture/pr114787.c: New testcase. (cherry picked from commit cc48418cfc2e555d837ae9138cbfac23acb3cdf9)