https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109849
--- Comment #11 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:9e2017ae6ac788d3e36999bb0f0d20ea0f62c20e commit r14-1127-g9e2017ae6ac788d3e36999bb0f0d20ea0f62c20e Author: Richard Biener <rguent...@suse.de> Date: Thu May 18 13:52:29 2023 +0200 tree-optimization/109849 - missed code hoisting The following fixes code hoisting to properly consider ANTIC_OUT instead of ANTIC_IN. That's a bit expensive to re-compute but since we no longer iterate we're doing this only once per BB which should be acceptable. This avoids missing hoistings to the end of blocks where something in the block clobbers the hoisted value. PR tree-optimization/109849 * tree-ssa-pre.cc (do_hoist_insertion): Compute ANTIC_OUT and use that to determine what to hoist. * gcc.dg/tree-ssa/ssa-hoist-8.c: New testcase.