https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121762
--- Comment #14 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:415f21fed2c5411cc6a378317f7142b22a623358 commit r16-4202-g415f21fed2c5411cc6a378317f7142b22a623358 Author: Andrew Pinski <[email protected]> Date: Tue Sep 23 12:14:47 2025 -0700 fab/forwprop: Move optimize_unreachable to forwprop [PR121762] This moves the optimize_unreachable to forwprop from fab. There is a slightly optimization here in that the first statement is checked and outside of the main fold loop. And if the statement is __builtin_unreachable, then call optimize_unreachable. Changes since v1: * v2: simplified the check for BUILT_IN_UNREACHABLE to just use gimple_call_builtin_p. Move the code after checking for not executable blocks. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/121762 gcc/ChangeLog: * tree-ssa-ccp.cc (optimize_unreachable): Move to tree-ssa-forwprop.cc (pass_fold_builtins::execute): Remove handling of __builtin_unreachable. * tree-ssa-forwprop.cc (optimize_unreachable): New function from tree-ssa-ccp.cc. Change argument to bb. Remove check on first statement being the __builtin_unreachable since it is handled already. (pass_forwprop::execute): Handle first statement as being __builtin_unreachable by calling optimize_unreachable. Signed-off-by: Andrew Pinski <[email protected]>
