]> gcc.gnu.org Git - gcc.git/commitdiff
rtl-optimization/109237 - speedup bb_is_just_return
authorRichard Biener <rguenther@suse.de>
Wed, 22 Mar 2023 09:05:19 +0000 (10:05 +0100)
committerRichard Biener <rguenther@suse.de>
Mon, 27 Mar 2023 06:54:30 +0000 (08:54 +0200)
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.

gcc/cfgcleanup.cc

index 194e0e5de123aa4674bc238075e8f06185a4a159..4cd33878ef359aaec01d90508dcdf7c6d5fd9ca0 100644 (file)
@@ -2608,7 +2608,7 @@ bb_is_just_return (basic_block bb, rtx_insn **ret, rtx_insn **use)
   if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun))
     return false;
 
-  FOR_BB_INSNS (bb, insn)
+  FOR_BB_INSNS_REVERSE (bb, insn)
     if (NONDEBUG_INSN_P (insn))
       {
        rtx pat = PATTERN (insn);
This page took 0.066612 seconds and 5 git commands to generate.