From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BA29F385AC12; Sun, 22 Aug 2021 08:47:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA29F385AC12 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/87238] Redundant Restore of $x0 when memcpy always returns the first argument. Date: Sun, 22 Aug 2021 08:47:48 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 7.3.0 X-Bugzilla-Keywords: missed-optimization, ra X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia 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: keywords 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2021 08:47:48 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D87238 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ra --- Comment #4 from Andrew Pinski --- Note I had to change the testcase to be using size 128. But this is interesting, IRA was able to figure the memset return value: (call_insn 14 13 17 2 (parallel [ (set (reg:DI 0 x0) (call (mem:DI (symbol_ref:DI ("memcpy") [flags 0x41]=20 ) [0 __builtin_memcpy S8 A8]) (const_int 0 [0]))) (unspec:DI [ (const_int 0 [0]) ] UNSPEC_CALLEE_ABI) (clobber (reg:DI 30 x30)) ]) "/app/example.cpp":10:16 47 {*call_value_insn} (expr_list:REG_RETURNED (reg/f:DI 95) (expr_list:REG_DEAD (reg:DI 2 x2) (expr_list:REG_DEAD (reg:DI 1 x1) (expr_list:REG_UNUSED (reg:DI 0 x0) (expr_list:REG_CALL_DECL (symbol_ref:DI ("memcpy") [fla= gs 0x41] ) (expr_list:REG_EH_REGION (const_int 0 [0]) (nil))))))) (expr_list (clobber (reg:DI 17 x17)) (expr_list (clobber (reg:DI 16 x16)) (expr_list:DI (set (reg:DI 0 x0) (reg:DI 0 x0)) (expr_list:DI (use (reg:DI 0 x0)) (expr_list:DI (use (reg:DI 1 x1)) (expr_list:DI (use (reg:DI 2 x2)) (nil)))))))) (insn 17 14 18 2 (set (reg:DI 0 x0) (reg/f:DI 95)) "/app/example.cpp":10:16 53 {*movdi_aarch64} (expr_list:REG_DEAD (reg/f:DI 95) (expr_list:REG_EQUAL (plus:DI (reg/f:DI 64 sfp) (const_int -512 [0xfffffffffffffe00])) (nil)))) But not actually use it. REG_RETURNED (reg/f:DI 95) Instead if used the REG_EQUAL ....=