public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/50164] New: [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count
@ 2011-08-23 14:39 enkovich.gnu at gmail dot com
  2011-08-24 16:15 ` [Bug target/50164] " vmakarov at redhat dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: enkovich.gnu at gmail dot com @ 2011-08-23 14:39 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50164
           Summary: [IRA, 4.7 Regression] Performance degradation due to
                    increased memory instructions count
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: enkovich.gnu@gmail.com


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

Problem occurs with -march=atom option used on the following part of test case:

  xc = (e_u8) (xc - xk);
  xm = (e_u8) (xm - xk);
  xy = (e_u8) (xy - xk);

  *EritePtr++ = xc;
  *EritePtr++ = xm;
  *EritePtr++ = xy;
  *EritePtr++ = xk;

xk has the most usages here and GCC 4.6 keeps it on register but GCC 4.7 keeps
it on stack which leads to increased number of memory instructions for that
code. On Core i7 GCC 4.7 generates code x1.5 slower than GCC 4.6. On Atom it is
~10% slower.

GCC 4.6 info:
Configured with: /export/users/mstester/stability/svn/gcc-4_6-branch/configure
--with-arch=corei7 --with-cpu=corei7 --enable-clocale=gnu --with-system-zlib
--enable-shared --with-demangler-in-ld --enable-cloog-backend=isl
--with-fpmath=sse
--prefix=/export/users/mstester/stability/work/gcc-4_6-branch/64/install
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.6.2 20110822 (prerelease) (GCC)
COLLECT_GCC_OPTIONS='-O2' '-march=atom' '-m32' '-o' 'test.4.6' '-v'

/nfs/ims/proj/icl/gcc/gnu/compilers/gcc/gcc-4_6-branch/64/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.6.2/cc1
-quiet -v -imultilib 32 -iprefix
/nfs/ims/proj/icl/gcc/gnu/compilers/gcc/gcc-4_6-branch/64/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.2/
test.c -quiet -dumpbase test.c -march=atom -m32 -auxbase test -O2 -version -o
/tmp/ccM2NIHU.s
GNU C (GCC) version 4.6.2 20110822 (prerelease) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.6.2 20110822 (prerelease), GMP version
4.3.1, MPFR version 2.4.2, MPC version 0.8.1

GCC 4.7 info:
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-master/configure --prefix=/export/gcc-master-build
Thread model: posix
gcc version 4.7.0 20110822 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-O2' '-march=atom' '-m32' '-o' 'test.4.7' '-v'
 /export/gcc-master-build/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/cc1 -quiet
-v -imultilib 32 test.c -quiet -dumpbase test.c -march=atom -m32 -auxbase test
-O2 -version -o /tmp/cc5DRHOU.s
GNU C (GCC) version 4.7.0 20110822 (experimental) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.7.0 20110822 (experimental), GMP version
4.3.2, MPFR version 3.0.0, MPC version 0.8.3-dev


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

* [Bug target/50164] [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count
  2011-08-23 14:39 [Bug target/50164] New: [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count enkovich.gnu at gmail dot com
@ 2011-08-24 16:15 ` vmakarov at redhat dot com
  2011-08-24 18:10 ` hjl.tools at gmail dot com
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: vmakarov at redhat dot com @ 2011-08-24 16:15 UTC (permalink / raw)
  To: gcc-bugs

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

Vladimir Makarov <vmakarov at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vmakarov at redhat dot com

--- Comment #1 from Vladimir Makarov <vmakarov at redhat dot com> 2011-08-24 16:02:57 UTC ---
Yesterday I sent a patch
http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01954.html which most probably
solved the problem.

Now I have code size 419 (gcc 4.6) vs 411 (gcc as of Aug 24) bytes for the
test.


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

* [Bug target/50164] [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count
  2011-08-23 14:39 [Bug target/50164] New: [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count enkovich.gnu at gmail dot com
  2011-08-24 16:15 ` [Bug target/50164] " vmakarov at redhat dot com
@ 2011-08-24 18:10 ` hjl.tools at gmail dot com
  2011-08-25  9:36 ` enkovich.gnu at gmail dot com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2011-08-24 18:10 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.7.0


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

* [Bug target/50164] [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count
  2011-08-23 14:39 [Bug target/50164] New: [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count enkovich.gnu at gmail dot com
  2011-08-24 16:15 ` [Bug target/50164] " vmakarov at redhat dot com
  2011-08-24 18:10 ` hjl.tools at gmail dot com
@ 2011-08-25  9:36 ` enkovich.gnu at gmail dot com
  2011-08-25 14:28 ` hjl.tools at gmail dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: enkovich.gnu at gmail dot com @ 2011-08-25  9:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Ilya Enkovich <enkovich.gnu at gmail dot com> 2011-08-25 09:31:29 UTC ---
(In reply to comment #1)
> Yesterday I sent a patch
> http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01954.html which most probably
> solved the problem.
> 
> Now I have code size 419 (gcc 4.6) vs 411 (gcc as of Aug 24) bytes for the
> test.

I tried it but unfortunately it did not solve the regression. We still have xk
on the stack and x1.5 more memory accesses in GCC 4.7 assembly for mentioned
code part. GCC 4.6 produces bigger but faster code.

Problem somehow appears only when -march=atom is used. There is no degradation
if generic arch is used. I compared GCC 4.7 dumps for "-O2 -m32" and "-O2 -m32
-march=atom" and found that RTLs are same before IRA and differ after IRA. 

How does -march=atom affects register allocation?


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

* [Bug target/50164] [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count
  2011-08-23 14:39 [Bug target/50164] New: [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count enkovich.gnu at gmail dot com
                   ` (2 preceding siblings ...)
  2011-08-25  9:36 ` enkovich.gnu at gmail dot com
@ 2011-08-25 14:28 ` hjl.tools at gmail dot com
  2011-08-26 21:30 ` hjl.tools at gmail dot com
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2011-08-25 14:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> 2011-08-25 13:58:28 UTC ---
(In reply to comment #2)
> (In reply to comment #1)
> > Yesterday I sent a patch
> > http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01954.html which most probably
> > solved the problem.
> > 
> > Now I have code size 419 (gcc 4.6) vs 411 (gcc as of Aug 24) bytes for the
> > test.
> 
> I tried it but unfortunately it did not solve the regression. We still have xk
> on the stack and x1.5 more memory accesses in GCC 4.7 assembly for mentioned
> code part. GCC 4.6 produces bigger but faster code.
> 

Can you find which checkin caused this?


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

* [Bug target/50164] [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count
  2011-08-23 14:39 [Bug target/50164] New: [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count enkovich.gnu at gmail dot com
                   ` (3 preceding siblings ...)
  2011-08-25 14:28 ` hjl.tools at gmail dot com
@ 2011-08-26 21:30 ` hjl.tools at gmail dot com
  2011-08-29  7:30 ` enkovich.gnu at gmail dot com
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2011-08-26 21:30 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2011-08-26
     Ever Confirmed|0                           |1

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> 2011-08-26 21:10:07 UTC ---
On Atom with -m32 -O2 -march=atom,

1. GCC 4.6.1:

./4.6  64.16s user 0.01s system 99% cpu 1:04.18 total

2. GCC 4.7.0 20110819:

./0819  69.73s user 0.01s system 99% cpu 1:09.76 total

3. GCC 4.7.0 20110826:

./0826  64.30s user 0.02s system 99% cpu 1:04.33 total

Has this problem been fixed?


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

* [Bug target/50164] [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count
  2011-08-23 14:39 [Bug target/50164] New: [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count enkovich.gnu at gmail dot com
                   ` (4 preceding siblings ...)
  2011-08-26 21:30 ` hjl.tools at gmail dot com
@ 2011-08-29  7:30 ` enkovich.gnu at gmail dot com
  2011-08-29  8:04 ` enkovich.gnu at gmail dot com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: enkovich.gnu at gmail dot com @ 2011-08-29  7:30 UTC (permalink / raw)
  To: gcc-bugs

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

Ilya Enkovich <enkovich.gnu at gmail dot com> changed:

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

--- Comment #5 from Ilya Enkovich <enkovich.gnu at gmail dot com> 2011-08-29 07:01:38 UTC ---
(In reply to comment #4)
> On Atom with -m32 -O2 -march=atom,
> 
> 1. GCC 4.6.1:
> 
> ./4.6  64.16s user 0.01s system 99% cpu 1:04.18 total
> 
> 2. GCC 4.7.0 20110819:
> 
> ./0819  69.73s user 0.01s system 99% cpu 1:09.76 total
> 
> 3. GCC 4.7.0 20110826:
> 
> ./0826  64.30s user 0.02s system 99% cpu 1:04.33 total
> 
> Has this problem been fixed?

Confirm. Problem has gone.


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

* [Bug target/50164] [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count
  2011-08-23 14:39 [Bug target/50164] New: [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count enkovich.gnu at gmail dot com
                   ` (5 preceding siblings ...)
  2011-08-29  7:30 ` enkovich.gnu at gmail dot com
@ 2011-08-29  8:04 ` enkovich.gnu at gmail dot com
  2011-08-30 10:52 ` enkovich.gnu at gmail dot com
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: enkovich.gnu at gmail dot com @ 2011-08-29  8:04 UTC (permalink / raw)
  To: gcc-bugs

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

Ilya Enkovich <enkovich.gnu at gmail dot com> changed:

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

--- Comment #6 from Ilya Enkovich <enkovich.gnu at gmail dot com> 2011-08-29 07:39:09 UTC ---
It appeared problem was fixed in reproducer but was not fixed in original test
case. I'll prepare fixed reproducer.


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

* [Bug target/50164] [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count
  2011-08-23 14:39 [Bug target/50164] New: [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count enkovich.gnu at gmail dot com
                   ` (6 preceding siblings ...)
  2011-08-29  8:04 ` enkovich.gnu at gmail dot com
@ 2011-08-30 10:52 ` enkovich.gnu at gmail dot com
  2011-08-30 11:30 ` enkovich.gnu at gmail dot com
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: enkovich.gnu at gmail dot com @ 2011-08-30 10:52 UTC (permalink / raw)
  To: gcc-bugs

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

Ilya Enkovich <enkovich.gnu at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #25083|0                           |1
        is obsolete|                            |

--- Comment #7 from Ilya Enkovich <enkovich.gnu at gmail dot com> 2011-08-30 10:40:50 UTC ---
Created attachment 25138
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25138
Fixed reproducer


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

* [Bug target/50164] [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count
  2011-08-23 14:39 [Bug target/50164] New: [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count enkovich.gnu at gmail dot com
                   ` (7 preceding siblings ...)
  2011-08-30 10:52 ` enkovich.gnu at gmail dot com
@ 2011-08-30 11:30 ` enkovich.gnu at gmail dot com
  2011-10-27 10:04 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: enkovich.gnu at gmail dot com @ 2011-08-30 11:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Ilya Enkovich <enkovich.gnu at gmail dot com> 2011-08-30 10:50:44 UTC ---
I attached a fixed reproducer. It is closer to the original test and has higher
registers pressure then the previous version. It has the same problem as the
first reproducer. 

Reproduced with GCC 4.7.0 20110828 and options "-O2 -m32 -march=atom". Code
becomes faster on both Atom (~10%) and Core (~35%) if I use just "-O2 -m32".


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

* [Bug target/50164] [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count
  2011-08-23 14:39 [Bug target/50164] New: [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count enkovich.gnu at gmail dot com
                   ` (8 preceding siblings ...)
  2011-08-30 11:30 ` enkovich.gnu at gmail dot com
@ 2011-10-27 10:04 ` rguenth at gcc dot gnu.org
  2011-10-27 20:29 ` izamyatin at gmail dot com
  2011-10-28 10:11 ` enkovich.gnu at gmail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-10-27 10:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-10-27 10:01:44 UTC ---
Still needs a proper analysis I suppose.


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

* [Bug target/50164] [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count
  2011-08-23 14:39 [Bug target/50164] New: [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count enkovich.gnu at gmail dot com
                   ` (9 preceding siblings ...)
  2011-10-27 10:04 ` rguenth at gcc dot gnu.org
@ 2011-10-27 20:29 ` izamyatin at gmail dot com
  2011-10-28 10:11 ` enkovich.gnu at gmail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: izamyatin at gmail dot com @ 2011-10-27 20:29 UTC (permalink / raw)
  To: gcc-bugs

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

Igor Zamyatin <izamyatin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |izamyatin at gmail dot com

--- Comment #10 from Igor Zamyatin <izamyatin at gmail dot com> 2011-10-27 20:28:47 UTC ---
I see that currently code for reproducer looks good. Surprisingly it happened
after revision 179275 (fix for PR 43864) which seems to be irrelevant here. And
indeed I have another test that shows a problem apparently in IRA or somewhere
near it. 
This new problem actually is not about regression so I suggest to close this
tracker and I will open another one once I prepare good test case.


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

* [Bug target/50164] [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count
  2011-08-23 14:39 [Bug target/50164] New: [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count enkovich.gnu at gmail dot com
                   ` (10 preceding siblings ...)
  2011-10-27 20:29 ` izamyatin at gmail dot com
@ 2011-10-28 10:11 ` enkovich.gnu at gmail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: enkovich.gnu at gmail dot com @ 2011-10-28 10:11 UTC (permalink / raw)
  To: gcc-bugs

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

Ilya Enkovich <enkovich.gnu at gmail dot com> changed:

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

--- Comment #11 from Ilya Enkovich <enkovich.gnu at gmail dot com> 2011-10-28 10:10:42 UTC ---
Initially problem was caused by movzbl cost value for Atom. Low cost of movzbl
made IRA keep frequently used byte value on the stack and assign register for
int value. Change cost model resolves the problem and it has been fixed in
revision 179999.


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

end of thread, other threads:[~2011-10-28 10:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-23 14:39 [Bug target/50164] New: [IRA, 4.7 Regression] Performance degradation due to increased memory instructions count enkovich.gnu at gmail dot com
2011-08-24 16:15 ` [Bug target/50164] " vmakarov at redhat dot com
2011-08-24 18:10 ` hjl.tools at gmail dot com
2011-08-25  9:36 ` enkovich.gnu at gmail dot com
2011-08-25 14:28 ` hjl.tools at gmail dot com
2011-08-26 21:30 ` hjl.tools at gmail dot com
2011-08-29  7:30 ` enkovich.gnu at gmail dot com
2011-08-29  8:04 ` enkovich.gnu at gmail dot com
2011-08-30 10:52 ` enkovich.gnu at gmail dot com
2011-08-30 11:30 ` enkovich.gnu at gmail dot com
2011-10-27 10:04 ` rguenth at gcc dot gnu.org
2011-10-27 20:29 ` izamyatin at gmail dot com
2011-10-28 10:11 ` enkovich.gnu at gmail dot com

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