https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62016
Bug ID: 62016 Summary: very slow compilation at -O3 on x86_64-linux-gnu Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu The following test case takes the current gcc trunk much longer to compile at -O3 on x86_64-linux (in both 32-bit and 64-bit modes). It also affects gcc 4.8.x and 4.9.x, and is a regression from 4.7.x. This is likely due to the inliner as the code compiles fine with -fno-inline. $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.10.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix gcc version 4.10.0 20140804 (experimental) [trunk revision 213529] (GCC) $ $ time gcc-trunk -O2 small.c 0.02user 0.01system 0:00.28elapsed 15%CPU (0avgtext+0avgdata 50912maxresident)k 0inputs+32outputs (1major+6643minor)pagefaults 0swaps $ time gcc-4.7 -O3 small.c 0.11user 0.02system 0:00.71elapsed 19%CPU (0avgtext+0avgdata 65344maxresident)k 0inputs+32outputs (1major+7683minor)pagefaults 0swaps $ $ time gcc-trunk -O3 -fno-inline small.c 0.04user 0.01system 0:00.47elapsed 12%CPU (0avgtext+0avgdata 51776maxresident)k 0inputs+32outputs (1major+6709minor)pagefaults 0swaps $ $ time gcc-trunk -O3 small.c 8.43user 0.28system 0:34.83elapsed 25%CPU (0avgtext+0avgdata 1622880maxresident)k 0inputs+32outputs (1major+106347minor)pagefaults 0swaps $ ---------------------------------- #include <assert.h> int a, b, c, d, e, f, g, h, i, j; void fn1 (int *p1, int *p2) { for (; a; a++) { assert (p1 == 0); fn1 (0, p2); fn1 (&i, &b); fn1 (&f, 0); } } void fn2 () { fn1 (&c, 0); fn1 (&d, 0); fn1 (&e, 0); fn1 (&g, 0); fn1 (&h, 0); fn1 (&j, 0); } int main () { fn2 (); return 0; }