[Bug tree-optimization/123061] [13/14/15 Regression] wrong code at -O3 with -ffinite-loops on x86_64-linux-gnu since r12-3313
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Mar 16 11:44:41 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123061
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:95ce1bf40d85fb033b54cad10912830a3e92df07
commit r15-10970-g95ce1bf40d85fb033b54cad10912830a3e92df07
Author: Richard Biener <rguenther@suse.de>
Date: Wed Jan 7 10:23:22 2026 +0100
tree-optimization/123061 - invalid hoisting of division
The following fixes the computation of always-exeecuted-in in the LIM
pass which was enhanced to handle inner loops in a better way but
in this process ended up setting inner loop always-executed-in state
based on outer loop analysis, which is wrong because an inner loop
block needs to be proven to be always executed for all inner loop
iterations as well, not only for all outer loop iterations.
The fix is to iterate over inner loops first and when processing
an outer loop only update always-executedness if a block belongs
to the very same loop or an immediately nested loop and always
executed inside that.
PR tree-optimization/123061
PR tree-optimization/123636
* tree-ssa-loop-im.cc (fill_always_executed_in_1): Change
outer-to-inner to inner-to-outer iteration. Update inner
loop state only when always executed in an immediately
nested loop.
* gcc.dg/torture/pr123061.c: New testcase.
* gcc.dg/torture/pr123636.c: Likewise.
* gcc.dg/tree-ssa/ssa-lim-26.c: Likewise.
(cherry picked from commit e48704694d686de1aaaaf934c04a2eda1a6033cb)
More information about the Gcc-bugs
mailing list