public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/56295] New: [4.8 Regression] Missed optimization with LTO
@ 2013-02-12 10:54 d.g.gorbachev at gmail dot com
  2013-02-12 11:02 ` [Bug lto/56295] " d.g.gorbachev at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: d.g.gorbachev at gmail dot com @ 2013-02-12 10:54 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56295

             Bug #: 56295
           Summary: [4.8 Regression] Missed optimization with LTO
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: d.g.gorbachev@gmail.com


Created attachment 29422
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29422
Testcase

In this testcase, LTO generates a call to memcpy at -O3 optimization level.


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

* [Bug lto/56295] [4.8 Regression] Missed optimization with LTO
  2013-02-12 10:54 [Bug lto/56295] New: [4.8 Regression] Missed optimization with LTO d.g.gorbachev at gmail dot com
@ 2013-02-12 11:02 ` d.g.gorbachev at gmail dot com
  2013-02-12 12:21 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: d.g.gorbachev at gmail dot com @ 2013-02-12 11:02 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56295

--- Comment #1 from Dmitry Gorbachev <d.g.gorbachev at gmail dot com> 2013-02-12 11:02:05 UTC ---
Created attachment 29423
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29423
Three other testcases

These are unrelated testcases which also demonstrate differences between LTO
and non-LTO.


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

* [Bug lto/56295] [4.8 Regression] Missed optimization with LTO
  2013-02-12 10:54 [Bug lto/56295] New: [4.8 Regression] Missed optimization with LTO d.g.gorbachev at gmail dot com
  2013-02-12 11:02 ` [Bug lto/56295] " d.g.gorbachev at gmail dot com
@ 2013-02-12 12:21 ` rguenth at gcc dot gnu.org
  2013-02-12 14:05 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-02-12 12:21 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56295

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-02-12
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.8.0
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-12 12:21:19 UTC ---
With -O3 -flto the loop is not peeled before loop-distribution and thus the
inner loop is identified as memcpy.  With -O3 the inner loop is peeled.

That is because at cunrolli we see with -flto

Statement _8 = b[i_1][j_2];
 is probably executed at most 3 (bounded by 3) + 1 times in loop 2.

vs. without -flto

Statement _8 = b[i_1][j_2];
 is executed at most 3 (bounded by 3) + 1 times in loop 1.

With -flto we run into

  /* For arrays at the end of the structure, we are not guaranteed that they
     do not really extend over their declared size.  However, for arrays of
     size greater than one, this is unlikely to be intended.  */
  if (array_at_struct_end_p (base))
    {
      at_end = true;
      upper = false;

for b[i_1][j_2] (where it is really a MEM[&b][i_1][j_2]).  That's because
array_at_struct_end_p doesn't consider MEM_REFs and we (in this case)
needlessly wrap b in a MEM_REF during streaming out (so that at input time
prevailing decl replacement does not change aliasing / tree code validity).
We should probably undo this at streaming in time where possible.

I have a patch that does this.


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

* [Bug lto/56295] [4.8 Regression] Missed optimization with LTO
  2013-02-12 10:54 [Bug lto/56295] New: [4.8 Regression] Missed optimization with LTO d.g.gorbachev at gmail dot com
  2013-02-12 11:02 ` [Bug lto/56295] " d.g.gorbachev at gmail dot com
  2013-02-12 12:21 ` rguenth at gcc dot gnu.org
@ 2013-02-12 14:05 ` rguenth at gcc dot gnu.org
  2013-02-12 14:05 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-02-12 14:05 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56295

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-12 14:04:50 UTC ---
Author: rguenth
Date: Tue Feb 12 14:04:44 2013
New Revision: 195976

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195976
Log:
2013-02-12  Richard Biener  <rguenther@suse.de>

    PR lto/56295
    * gimple-streamer-in.c (input_gimple_stmt): Strip MEM_REFs off
    decls again if possible.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimple-streamer-in.c


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

* [Bug lto/56295] [4.8 Regression] Missed optimization with LTO
  2013-02-12 10:54 [Bug lto/56295] New: [4.8 Regression] Missed optimization with LTO d.g.gorbachev at gmail dot com
                   ` (2 preceding siblings ...)
  2013-02-12 14:05 ` rguenth at gcc dot gnu.org
@ 2013-02-12 14:05 ` rguenth at gcc dot gnu.org
  2013-02-12 16:27 ` d.g.gorbachev at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-02-12 14:05 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56295

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-12 14:05:17 UTC ---
Fixed.


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

* [Bug lto/56295] [4.8 Regression] Missed optimization with LTO
  2013-02-12 10:54 [Bug lto/56295] New: [4.8 Regression] Missed optimization with LTO d.g.gorbachev at gmail dot com
                   ` (3 preceding siblings ...)
  2013-02-12 14:05 ` rguenth at gcc dot gnu.org
@ 2013-02-12 16:27 ` d.g.gorbachev at gmail dot com
  2013-02-13 11:51 ` rguenth at gcc dot gnu.org
  2013-02-13 13:31 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: d.g.gorbachev at gmail dot com @ 2013-02-12 16:27 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56295

--- Comment #5 from Dmitry Gorbachev <d.g.gorbachev at gmail dot com> 2013-02-12 16:26:39 UTC ---
Created attachment 29425
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29425
Modified testcase

This slightly modified testcase still shows some strange difference between LTO
/ non-LTO.


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

* [Bug lto/56295] [4.8 Regression] Missed optimization with LTO
  2013-02-12 10:54 [Bug lto/56295] New: [4.8 Regression] Missed optimization with LTO d.g.gorbachev at gmail dot com
                   ` (4 preceding siblings ...)
  2013-02-12 16:27 ` d.g.gorbachev at gmail dot com
@ 2013-02-13 11:51 ` rguenth at gcc dot gnu.org
  2013-02-13 13:31 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-02-13 11:51 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56295

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-13 11:51:18 UTC ---
(In reply to comment #5)
> Created attachment 29425 [details]
> Modified testcase
> 
> This slightly modified testcase still shows some strange difference between LTO
> / non-LTO.

The difference is from the compilation, not the link!  That's because of the
very same reason - us wrapping all global decls in MEM_REFs.  We do that
at compilation time (when we stream the GIMPLE IL), and this change persists.

I have another patch ;)


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

* [Bug lto/56295] [4.8 Regression] Missed optimization with LTO
  2013-02-12 10:54 [Bug lto/56295] New: [4.8 Regression] Missed optimization with LTO d.g.gorbachev at gmail dot com
                   ` (5 preceding siblings ...)
  2013-02-13 11:51 ` rguenth at gcc dot gnu.org
@ 2013-02-13 13:31 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-02-13 13:31 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56295

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-13 13:31:24 UTC ---
Author: rguenth
Date: Wed Feb 13 13:31:18 2013
New Revision: 196013

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196013
Log:
2013-02-13  Richard Biener  <rguenther@suse.de>

    PR lto/56295
    * gimple-streamer-out.c (output_gimple_stmt): Undo wrapping
    globals in MEM_REFs.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimple-streamer-out.c


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

end of thread, other threads:[~2013-02-13 13:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-12 10:54 [Bug lto/56295] New: [4.8 Regression] Missed optimization with LTO d.g.gorbachev at gmail dot com
2013-02-12 11:02 ` [Bug lto/56295] " d.g.gorbachev at gmail dot com
2013-02-12 12:21 ` rguenth at gcc dot gnu.org
2013-02-12 14:05 ` rguenth at gcc dot gnu.org
2013-02-12 14:05 ` rguenth at gcc dot gnu.org
2013-02-12 16:27 ` d.g.gorbachev at gmail dot com
2013-02-13 11:51 ` rguenth at gcc dot gnu.org
2013-02-13 13:31 ` rguenth 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).