Bug 23378 - [4.1/4.2 Regression] code quality regression for complicated loop
Summary: [4.1/4.2 Regression] code quality regression for complicated loop
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.1.0
: P2 minor
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on: 23302 23303
Blocks:
  Show dependency treegraph
 
Reported: 2005-08-13 18:03 UTC by Martin Reinecke
Modified: 2005-12-12 02:46 UTC (History)
3 users (show)

See Also:
Host:
Target: i?86-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
A testcase for the problem (24.11 KB, application/x-gzip)
2005-08-13 18:05 UTC, Martin Reinecke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Reinecke 2005-08-13 18:03:12 UTC
A code quality regression was introduced into CVS between the timestamps
"-D 20050729 22:00:00 UT" and "-D 20050729 23:00:00 UT". It appears that
it iss caused by Jan Hubicka's patch from
http://gcc.gnu.org/ml/gcc-patches/2005-07/msg02021.html

If the attached testcase is compiled with the newer compiler, the runtime
of the generated executable is more than 50 per cent higher:

old compiler:

~/tmp/tmp2>g++ -O3 -march=pentium4 -mfpmath=sse testcase.cc
~/tmp/tmp2>time ./a.out
14.250u 0.020s 0:14.27 100.0%   0+0k 0+0io 205pf+0w


new compiler:

~/tmp/tmp2>g++ -O3 -march=pentium4 -mfpmath=sse testcase.cc
~/tmp/tmp2>time ./a.out
22.430u 0.030s 0:22.46 100.0%   0+0k 0+0io 205pf+0w


Both compilers have the same "g++ -v" output:

~/tmp/tmp2>g++ -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /scratch/gcc/configure --quiet
--prefix=/afs/mpa/data/martin/ugcc --enable-languages=c++
--enable-mapped-location --disable-checking
Thread model: posix
gcc version 4.1.0 20050729 (experimental)


The hot spot of the code is the strange "loop" in lines 134-139
of alm_map_tools_orig.cc.
Comment 1 Martin Reinecke 2005-08-13 18:05:27 UTC
Created attachment 9494 [details]
A testcase for the problem
Comment 2 Steven Bosscher 2005-08-14 13:57:04 UTC
Ouch.  This badly needs reducing... 
Comment 3 Andrew Pinski 2005-08-14 14:06:55 UTC
I think this is related to PR 23302 and PR 23303 since those look like they were caused by the same 
patch.
Comment 4 Martin Reinecke 2005-08-16 08:33:41 UTC
(In reply to comment #2)
> Ouch.  This badly needs reducing... 

Absolutely. But since Andrew pointed out that it is probably related to PR 23302
and PR 23303 (which have nice testcases), I suggest I wait until these are fixed.
If, after that, the performance regression persists, I'll try to reduce the
testcase. Is that OK?
Comment 5 Mark Mitchell 2005-10-31 05:01:51 UTC
Leaving as P2.
Comment 6 Jan Hubicka 2005-10-31 18:24:20 UTC
I don't have P4 to test handy.  Can you re-test whether fixing 23302 (23303 is invalid) make any difference?
I doubt these two make actual runtime changes - the sequence would translate to same uops for P4 and should execute in about the same time.
Comment 7 Martin Reinecke 2005-11-01 10:22:57 UTC
The regression is unfortunately still there :(
Reducing the testcase is really hard, and I have some indications
that the problem vanishes if there is less work to do in the critical loop.
If you have any suggestion how to proceed, they would be greatly appreciated ...
Comment 8 Martin Reinecke 2005-12-11 09:40:56 UTC
I re-tested today with versions 3.3.2, 4.0-branch, 4.1-branch, trunk and gomp-branch, and could not reproduce the regression any more.
So I think this report can be closed. Thanks to the unknown patcher! ;)
Comment 9 Andrew Pinski 2005-12-12 02:46:21 UTC
Fixed so closing as such.