public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "law at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/64215] -Os misses an opportunity to merge two ret instructions
Date: Sat, 07 Oct 2023 19:47:31 +0000	[thread overview]
Message-ID: <bug-64215-4-LxjOXPLVZo@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64215-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64215

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org

--- Comment #5 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Andrew, the reason the patch you referenced doesn't help this case is because
we don't have an unconditional jump to a return only block.

To optimize this case we'd have to detect that we have a return only block that
is immediately preceded by another return block after bbro.

ie:

(note 48 23 59 6 [bb 6] NOTE_INSN_BASIC_BLOCK)
(insn 59 48 49 6 (use (reg/i:SI 10 a0)) -1
     (nil))
(jump_insn 49 59 37 6 (simple_return) 346 {simple_return}
     (nil)
 -> simple_return)
;; lr  out       1 [ra] 2 [sp] 10 [a0]
;; live  out     1 [ra] 2 [sp] 10 [a0]

;;  succ:       EXIT [always]  count:52738306 (estimated locally, freq 0.4591)

;; basic block 7, loop depth 0, count 6317494 (estimated locally, freq 0.0550),
maybe hot
;;  prev block 6, next block 1, flags: (REACHABLE, RTL)
;;  pred:       2 [5.5% (guessed)]  count:6317494 (estimated locally, freq
0.0550) (CAN_FALLTHRU)
;; bb 7 artificial_defs: { }
;; bb 7 artificial_uses: { u-1(2){ }}
;; lr  in        1 [ra] 2 [sp] 10 [a0]
;; lr  use       2 [sp] 10 [a0]
;; lr  def
;; live  in      1 [ra] 2 [sp] 10 [a0]
;; live  gen
;; live  kill

(code_label 37 49 36 7 4 (nil) [1 uses])
(note 36 37 60 7 [bb 7] NOTE_INSN_BASIC_BLOCK)
(insn 60 36 51 7 (use (reg/i:SI 10 a0)) -1
     (nil))
(jump_insn 51 60 41 7 (simple_return) 346 {simple_return}
     (nil)
 -> simple_return)

      parent reply	other threads:[~2023-10-07 19:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-07 23:36 [Bug target/64215] New: " mpeg.blue at free dot fr
2014-12-08  8:52 ` [Bug target/64215] " jakub at gcc dot gnu.org
2014-12-08 13:25 ` rguenth at gcc dot gnu.org
2021-08-09  7:36 ` pinskia at gcc dot gnu.org
2022-09-28 20:50 ` tommy_murphy at hotmail dot com
2022-09-28 21:02 ` pinskia at gcc dot gnu.org
2022-09-28 22:34 ` tommy_murphy at hotmail dot com
2023-10-07 19:47 ` law at gcc dot gnu.org [this message]

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=bug-64215-4-LxjOXPLVZo@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).