public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97464] New: Missed redundant store optimization opportunity
@ 2020-10-16 17:31 pdimov at gmail dot com
  2020-10-19  7:22 ` [Bug tree-optimization/97464] " rguenth at gcc dot gnu.org
  2021-08-15  0:18 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: pdimov at gmail dot com @ 2020-10-16 17:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97464
           Summary: Missed redundant store optimization opportunity
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pdimov at gmail dot com
  Target Milestone: ---

The code

    void f( int& x, float& y )
    {
        ++x;
        y = 1;
        --x;
    }

compiles to

    f(int&, float&):
        mov     eax, DWORD PTR [rdi]
        mov     DWORD PTR [rsi], 0x3f800000
        mov     DWORD PTR [rdi], eax
        ret

(https://godbolt.org/z/so4h3v)

but the load from, and the store to, [rdi] are redundant. It's obvious that
TBAA is active, but it for some reason doesn't go far enough.

This is a simplified example from "realer" code where x is a reference count
whose unnecessary manipulations could have been optimized out entirely.

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

end of thread, other threads:[~2021-08-15  0:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-16 17:31 [Bug c++/97464] New: Missed redundant store optimization opportunity pdimov at gmail dot com
2020-10-19  7:22 ` [Bug tree-optimization/97464] " rguenth at gcc dot gnu.org
2021-08-15  0:18 ` 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).