From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 688563857359; Sat, 7 Oct 2023 19:47:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 688563857359 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696708053; bh=DxG9lLvuFVecTjmGGfuMVufBfr/57sPwvYD2MBZ2qbQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jj7cfzyQQWZV0rwqsKgxUD7bgjbvHhf7LrTf9UDWGANr/sDhmPEWuB71uhtqoFV2Z lrYCRslJ43utOMXudwfeC8QbMxarJVnxU2E/RJaS64OBApaUZyMDSFvxfnFSS3eb+g FZ7pdeLVOh9n+xzIqABeGAiYbhevlb8mC/vS0RxU= From: "law at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: law at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D64215 Jeffrey A. Law changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |law at gcc dot gnu.org --- Comment #5 from Jeffrey A. Law --- Andrew, the reason the patch you referenced doesn't help this case is becau= se 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.45= 91) ;; basic block 7, loop depth 0, count 6317494 (estimated locally, freq 0.05= 50), 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)=