http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54896
Bug #: 54896
Summary: Some optimization slowness with GCC 4.7.2
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: [email protected]
ReportedBy: [email protected]
We have some code which consist from switch with many cases and non-random
memory writes. Look like there is nothing to optimize at all, but compiling
optimized version takes long time.
Attach is the code to generate source code to reproduce this problem,
generate_bigdata.c.
$ gcc generate_bigdata.c
$ ./a.out
(This step will generate the testcase, BigData.c.)
$ time /gcc-4.7.2/bin/gcc -m32 BigData.c -c -o BigData.o
1.504u 0.077s 0:01.61 97.5% 0+0k 320+10024io 0pf+0w
$ time /gcc-4.7.2/bin/gcc -m32 -O1 BigData.c -c -o BigData.o
50.438u 0.191s 0:50.67 99.9% 0+0k 256+10024io 0pf+0w
$ time /gcc-4.7.2/bin/gcc -m32 -O4 BigData.c -c -o BigData.o
111.710u 3.977s 1:55.73 99.9% 0+0k 1024+9384io 0pf+0w
We tried with gcc44, the optimization takes long also but not as bad as 472.
Sure, code refactoring is best solution and disabling optimization for
particular file is good enough, but will be good idea to improve GCC too.