https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109237
--- 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:776a5bb5894315ab144dc74222fc580fde8fdd87 commit r13-6873-g776a5bb5894315ab144dc74222fc580fde8fdd87 Author: Richard Biener <rguent...@suse.de> Date: Wed Mar 22 10:05:19 2023 +0100 rtl-optimization/109237 - speedup bb_is_just_return For the testcase bb_is_just_return is on top of the profile, changing it to walk BB insns backwards puts it off the profile. That's because in the forward walk you have to process possibly many debug insns but in a backward walk you very likely run into control insns first. PR rtl-optimization/109237 * cfgcleanup.cc (bb_is_just_return): Walk insns backwards.