aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgcleanup.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-03-22 10:05:19 +0100
committerRichard Biener <rguenther@suse.de>2023-04-19 10:28:42 +0200
commit8f81100115f68b37fb2723e987c14a3185d1f47d (patch)
treea1f531a5ddafa3ff6d56d67739c5d33de14401b3 /gcc/cfgcleanup.cc
parent794ffdb0fb6312ce07af0bfc797bef9f4cff4c61 (diff)
downloadgcc-8f81100115f68b37fb2723e987c14a3185d1f47d.zip
gcc-8f81100115f68b37fb2723e987c14a3185d1f47d.tar.gz
gcc-8f81100115f68b37fb2723e987c14a3185d1f47d.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.
Diffstat (limited to 'gcc/cfgcleanup.cc')
-rw-r--r--gcc/cfgcleanup.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/cfgcleanup.cc b/gcc/cfgcleanup.cc
index 194e0e5..78f59e9 100644
--- a/gcc/cfgcleanup.cc
+++ b/gcc/cfgcleanup.cc
@@ -2608,14 +2608,14 @@ 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);
if (!*ret && ANY_RETURN_P (pat))
*ret = insn;
- else if (!*ret && !*use && GET_CODE (pat) == USE
+ else if (*ret && !*use && GET_CODE (pat) == USE
&& REG_P (XEXP (pat, 0))
&& REG_FUNCTION_VALUE_P (XEXP (pat, 0)))
*use = insn;