From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Cc: Jakub Jelinek <jakub@redhat.com>
Subject: [PATCH] rtl-optimization/109237 - speedup bb_is_just_return
Date: Wed, 22 Mar 2023 10:03:42 +0000 (UTC) [thread overview]
Message-ID: <20230322100342.Im-WGjSLq2qNFV0lHIhVrkGdrXTGoLrEaRie9BFJ-wE@z> (raw)
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.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
OK?
For the record, the profile was (after the delete_trivially_dead_insns
fix)
Samples: 289K of event 'cycles:u', Event count (approx.): 384226334976
Overhead Samples Command Shared Object Symbol
3.52% 9747 cc1 cc1 [.] bb_is_just_return
#
and after the fix bb_is_just_return has no recorded samples anymore.
Thanks,
Richard.
PR rtl-optimization/109237
* cfgcleanup.cc (bb_is_just_return): Walk insns backwards.
---
gcc/cfgcleanup.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/cfgcleanup.cc b/gcc/cfgcleanup.cc
index 194e0e5de12..4cd33878ef3 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);
--
2.35.3
next reply other threads:[~2023-03-22 10:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 10:03 Richard Biener [this message]
[not found] <20230322100405.914ED38582AB@sourceware.org>
2023-03-26 18:01 ` Jeff Law
[not found] <20230322100356.5B99E3857C48@sourceware.org>
2023-03-28 7:49 ` Jakub Jelinek
2023-03-28 8:40 ` Richard Biener
2023-04-19 7:18 Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230322100342.Im-WGjSLq2qNFV0lHIhVrkGdrXTGoLrEaRie9BFJ-wE@z \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).