aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-03-22 10:05:19 +0100
committerRichard Biener <rguenther@suse.de>2023-03-27 08:54:30 +0200
commit776a5bb5894315ab144dc74222fc580fde8fdd87 (patch)
treeba6dd13bac13ff82c6e3e9f4bad4b43db6600d74
parent4cbd5ef0350d8ab04993eb4c48ab80999fb4f358 (diff)
downloadgcc-776a5bb5894315ab144dc74222fc580fde8fdd87.zip
gcc-776a5bb5894315ab144dc74222fc580fde8fdd87.tar.gz
gcc-776a5bb5894315ab144dc74222fc580fde8fdd87.tar.bz2
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.
-rw-r--r--gcc/cfgcleanup.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/cfgcleanup.cc b/gcc/cfgcleanup.cc
index 194e0e5..4cd3387 100644
--- a/gcc/cfgcleanup.cc
+++ b/gcc/cfgcleanup.cc
@@ -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);