https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123116
--- Comment #3 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:4204d3c46581bff5461e7b837e8bd3e1f2c24a2e commit r16-6152-g4204d3c46581bff5461e7b837e8bd3e1f2c24a2e Author: Andrew Pinski <[email protected]> Date: Sat Dec 13 20:48:51 2025 -0800 final_cleanup: Don't create forwarder blocks for degenerate_phis that are ifconvertable [PR123111] So it turns out creating a forwarder block in some cases causes a regression. The rtl ifcvt does like the case were the middle bb does not have a single predecessor. So in some cases ifcvt does not happen any more. So the way to fix this is not to create a forwarder block for those edges which causes out of ssa to create a middle bb which has the constant or the copy in it. I tried to do a simple ifcvt on the gimple level with the last phiopt but that introduces regressions as then `v += cmp - 43;` is not optimized and produces an extra subtraction. This is the best workaround I could come up with until that is fixed. I filed PR 123116 for that issue. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/123111 gcc/ChangeLog: * tree-cfg.cc (ifconvertable_edge): New function. (make_forwarders_with_degenerate_phis): Add skip_ifcvtable argument, check ifconvertable_edge if skip_ifcvtable is true. * tree-cfg.h (make_forwarders_with_degenerate_phis): New argument with default of false. * tree-cfgcleanup.cc (execute_cleanup_cfg_post_optimizing): Update argument to make_forwarders_with_degenerate_phis. Signed-off-by: Andrew Pinski <[email protected]>
