https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116835
--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <[email protected]>: https://gcc.gnu.org/g:f726857ded73f5692280a33be958ce75ffc54b18 commit r16-5557-gf726857ded73f5692280a33be958ce75ffc54b18 Author: Andrew Pinski <[email protected]> Date: Thu Nov 20 20:43:16 2025 -0800 phiprop: Avoid proping loads into loops [PR116835] This is v2 which uses Richi's code. This amends "the post-dominance check to deal with SSA cycles [...]. We need to constrain the load to be in the same or a subloop (use flow_loop_nested_p, not loop depth) or in the same BB when either the load or the PHI is in an irreducible region." (as described by Richard). Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/116835 gcc/ChangeLog: * tree-ssa-phiprop.cc (propagate_with_phi): Admend the post-dom check to deal with ssa cycles. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr116835.c: New test. * gcc.dg/tree-ssa/phiprop-6.c: New test. * gcc.dg/tree-ssa/phiprop-7.c: New test. Signed-off-by: Andrew Pinski <[email protected]> Co-authored-by: Richard Biener <[email protected]>
