https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63933

            Bug ID: 63933
           Summary: Build stage1 with -O2 during bootstrap if host
                    compiler is a recent gcc version
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org

Currently gcc doesn't add any optimization level flags during stage1.
This means that stage1 is build with the default -O0 and that results
in a very slow compiler. Build times during stage2 are very high
because of this.

One solution would be to detect the host compiler and if it is a
recent (maintained?) version of gcc, then build stage1 with -O2.

I did some rough measurements on gcc112:

With:
../gcc/configure --disable-libstdcxx-pch --disable-libvtv --disable-libitm
--disable-libcilkrts --disable-libssp --disable-libgomp --disable-werror
--disable-multilib --enable-languages=c,c++,fortran

I get for the current default:
make -j160  28473.74s user 481.93s system 2067% cpu 23:20.53 total

Adding -O2 during stage1 almost halves the bootstrap time:
make -j160  15233.80s user 446.17s system 1918% cpu 13:37.25 total

Reply via email to