https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45178
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:634c2bc38ff66f13164967a8e3b965e8255dd4d9 commit r11-9586-g634c2bc38ff66f13164967a8e3b965e8255dd4d9 Author: Richard Biener <rguent...@suse.de> Date: Fri Aug 27 09:47:49 2021 +0200 tree-optimization/45178 - DCE of dead control flow in infinite loop This fixes DCE to be able to elide dead control flow in an infinite loop without an exit edge. This special situation is handled well by the code finding an edge to preserve since there's no chance it will find the exit edge and make the loop finite. 2021-08-27 Richard Biener <rguent...@suse.de> PR tree-optimization/45178 * tree-ssa-dce.c (find_obviously_necessary_stmts): For infinite loops without exit do not mark control dependent edges of the latch necessary. * gcc.dg/tree-ssa/ssa-dce-3.c: Adjust testcase. (cherry picked from commit 41439e1f6d2da1e86538c726f0603cffd5dd098e)