public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/8776: loop invariants are not removed (most likely)
@ 2002-12-01 15:26 lomov1
0 siblings, 0 replies; only message in thread
From: lomov1 @ 2002-12-01 15:26 UTC (permalink / raw)
To: gcc-gnats
>Number: 8776
>Category: optimization
>Synopsis: loop invariants are not removed (most likely)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: pessimizes-code
>Submitter-Id: net
>Arrival-Date: Sun Dec 01 15:26:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: lomov1@yahoo.com
>Release: gcc version 3.2 (Mandrake Linux 9.0 3.2-1mdk); also with gcc-3.1
>Organization:
>Environment:
Linux 2.4.19-16mdk i686 GNU/Linux
Mandrake 9.0
AMD Athlon(tm) Processor stepping 2 cpu MHz 908.111
>Description:
There is a following program:
------
struct str{
int f[3];
};
int main (int argc, char *argv[])
{
double d[1];
double* pd=d;
str s;
int* pf=&s.f[0];
s.f[0]=s.f[1]=s.f[2]=0;
for (int i=0;i<1000000000;++i) {
#ifdef SLOW1
pd[s.f[0]+s.f[1]*s.f[2]]=1;
#elif defined(SLOW2)
d[pf[0]+pf[1]*pf[2]]=1;
#else
pd[pf[0]+pf[1]*pf[2]]=1;
#endif
}
}
------
after compilation with gcc-3.2 -O9 on Linux Mandrake 9.0 Athlon 900MHz,
time ./a.out of the SLOW[12] version gives >10s
time ./a.out of the "!defined(SLOW[12])" version gives 3.50s
Logically this is the same thing...
>How-To-Repeat:
gcc -O9 test.cpp ; time ./a.out
gcc -O9 -DSLOW1 test.cpp ; time ./a.out
gcc -O9 -DSLOW2 test.cpp ; time ./a.out
>Fix:
gcc-2.96 doesn't have this problem. Sorry, but I don't have access to other official (besides 3.1 and 3.2) releases
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.cpp"
aW50IG1haW4gKGludCBhcmdjLCBjaGFyICphcmd2W10pCnsKICAgZG91YmxlIGRbMV07CiAgIGRv
dWJsZSogcGQ9ZDsKICAgc3RyIHM7CiAgIGludCogcGY9JnMuZlswXTsKICAgcy5mWzBdPXMuZlsx
XT1zLmZbMl09MDsKICAgZm9yIChpbnQgaT0wO2k8MTAwMDAwMDAwMDsrK2kpIHsKI2lmZGVmIFNM
T1cxCiAgICAgIHBkW3MuZlswXStzLmZbMV0qcy5mWzJdXT0xOwojZWxpZiBkZWZpbmVkKFNMT1cy
KQogICAgICBkW3BmWzBdK3BmWzFdKnBmWzJdXT0xOwojZWxzZQogICAgICBwZFtwZlswXStwZlsx
XSpwZlsyXV09MTsKI2VuZGlmCiAgIH0KfQoK
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-12-01 23:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-01 15:26 optimization/8776: loop invariants are not removed (most likely) lomov1
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).