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

            Bug ID: 58479
           Summary: slow compilation on x86_64-linux at -O1 (and above)
                    with -g, but checking disabled
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The following code takes much longer to compile at -O1 (and above) with -g
using the current gcc trunk on x86_64-linux (in both 32-bit and 64-bit modes). 

It also affects 4.6, 4.7, and 4.8 (with checking disabled), but to a lesser
extent (4 seconds vs. 12 seconds at -O1 with -g). 

This seems to be related to 58318, but 58318 manifests only when checking is
enabled. 

This may also be related to 58478. 


$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/su/software/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure
--enable-languages=c,c++,objc,obj-c++,fortran,lto --enable-checking=release
--with-gmp=/home/su/software/local/gcc-trunk
--with-mpfr=/home/su/software/local/gcc-trunk
--with-mpc=/home/su/software/local/gcc-trunk
--with-cloog=/home/su/software/local/gcc-trunk
--prefix=/home/su/software/local/gcc-trunk
Thread model: posix
gcc version 4.9.0 20130917 (experimental) (GCC) 
$
$ time gcc -O0 -g small.c
0.02user 0.00system 0:00.13elapsed 27%CPU (0avgtext+0avgdata 37888maxresident)k
0inputs+56outputs (0major+6439minor)pagefaults 0swaps
$ time gcc -O1 small.c
0.02user 0.02system 0:00.14elapsed 30%CPU (0avgtext+0avgdata 40144maxresident)k
0inputs+32outputs (0major+6560minor)pagefaults 0swaps
$ time gcc -O1 -g small.c
7.69user 0.53system 0:12.20elapsed 67%CPU (0avgtext+0avgdata
2632224maxresident)k
0inputs+32outputs (0major+180567minor)pagefaults 0swaps
$


-------------------------------------


int a, b, c, d, e, f; 

int main ()
{
  for (a = 0; a < 8; a++)
    for (b = 0; b < 8; b++)
      for (c = 0; c < 8; c++)
    for (d = 0; d < 8; d++)
      for (e = 0; e < 8; e++)
        {
          int t[3][2][9] = {
        {{f, f, f, f, f, f, f, f, f},
         {f, f, f, f, f, f, f, f, f}},
        {{f, f, f, f, f, f, f, f, f},
         {f, f, f, f, f, f, f, f, f}},
        {{f, f, f, f, f, f, f, f, f},
         {f, f, f, f, f, f, f, f, f}},
          };
        }

  return 0;
}

Reply via email to