public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/87238] Redundant Restore of $x0 when memcpy always returns the first argument.
       [not found] <bug-87238-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-22  8:45 ` pinskia at gcc dot gnu.org
  2021-08-22  8:47 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-22  8:45 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=61241,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=101995

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Related to PR 101995.  IRA knows how to rematerialize the address of memset
already to be the return value just it is not doing it in this case.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug rtl-optimization/87238] Redundant Restore of $x0 when memcpy always returns the first argument.
       [not found] <bug-87238-4@http.gcc.gnu.org/bugzilla/>
  2021-08-22  8:45 ` [Bug rtl-optimization/87238] Redundant Restore of $x0 when memcpy always returns the first argument pinskia at gcc dot gnu.org
@ 2021-08-22  8:47 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-22  8:47 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ra

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
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] 
<function_decl 0x7efee90fd200 __builtin_memcpy>) [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") [flags
0x41]  <function_decl 0x7efee90fd200 __builtin_memcpy>)
                        (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 ....

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-22  8:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-87238-4@http.gcc.gnu.org/bugzilla/>
2021-08-22  8:45 ` [Bug rtl-optimization/87238] Redundant Restore of $x0 when memcpy always returns the first argument pinskia at gcc dot gnu.org
2021-08-22  8:47 ` pinskia at gcc dot gnu.org

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).