[Bug c++/71029] large fold expressions compile slowly with -Wall

alisdairm at me dot com gcc-bugzilla@gcc.gnu.org
Sat Feb 2 04:53:00 GMT 2019


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

--- Comment #2 from Alisdair Meredith <alisdairm at me dot com> ---
Having just discovered -ftime-report due to recent blog posts, I thought I
would repeat the experiment, and can confirm it is still an issue in the latest
development gcc available to me through MacPorts, dated October 2018.
-ftime-report info below:

time g++ -std=c++2a main.cpp -Wall -ftime-report

Time variable                                   usr           sys          wall
              GGC
 phase setup                        :   0.01 (  0%)   0.03 (  2%)   0.05 (  0%)
   1363 kB (  1%)
 phase parsing                      :   0.68 (  2%)   0.35 ( 19%)   1.08 (  3%)
  28535 kB ( 17%)
 phase lang. deferred               :  31.57 ( 87%)   0.25 ( 14%)  31.82 ( 84%)
  35883 kB ( 22%)
 phase opt and generate             :   3.85 ( 11%)   1.18 ( 65%)   5.06 ( 13%)
  99817 kB ( 60%)
 phase last asm                     :   0.01 (  0%)   0.00 (  0%)   0.01 (  0%)
     96 kB (  0%)
 |name lookup                       :   0.19 (  1%)   0.09 (  5%)   0.27 (  1%)
   1644 kB (  1%)
 |overload resolution               :   0.55 (  2%)   0.19 ( 10%)   0.66 (  2%)
  25705 kB ( 16%)
 garbage collection                 :   0.15 (  0%)   0.00 (  0%)   0.16 (  0%)
      0 kB (  0%)
 dump files                         :   0.18 (  0%)   0.18 ( 10%)   0.27 (  1%)
      0 kB (  0%)
 callgraph construction             :   0.11 (  0%)   0.08 (  4%)   0.26 (  1%)
   6708 kB (  4%)
 callgraph optimization             :   0.17 (  0%)   0.08 (  4%)   0.18 (  0%)
     64 kB (  0%)
 ipa function summary               :   0.01 (  0%)   0.00 (  0%)   0.01 (  0%)
      2 kB (  0%)
 ipa dead code removal              :   0.01 (  0%)   0.01 (  1%)   0.04 (  0%)
      0 kB (  0%)
 ipa inlining heuristics            :   0.03 (  0%)   0.00 (  0%)   0.02 (  0%)
      0 kB (  0%)
 ipa various optimizations          :   0.00 (  0%)   0.02 (  1%)   0.05 (  0%)
      0 kB (  0%)
 ipa free lang data                 :   0.00 (  0%)   0.01 (  1%)   0.02 (  0%)
      0 kB (  0%)
 ipa free inline summary            :   0.01 (  0%)   0.00 (  0%)   0.04 (  0%)
      0 kB (  0%)
 cfg construction                   :   0.03 (  0%)   0.01 (  1%)   0.02 (  0%)
      0 kB (  0%)
 cfg cleanup                        :   0.03 (  0%)   0.02 (  1%)   0.01 (  0%)
      0 kB (  0%)
 CFG verifier                       :   0.31 (  1%)   0.05 (  3%)   0.41 (  1%)
      0 kB (  0%)
 trivially dead code                :   0.00 (  0%)   0.00 (  0%)   0.01 (  0%)
      0 kB (  0%)
 df scan insns                      :   0.04 (  0%)   0.00 (  0%)   0.05 (  0%)
     96 kB (  0%)
 df live regs                       :   0.05 (  0%)   0.00 (  0%)   0.03 (  0%)
      0 kB (  0%)
 df reg dead/unused notes           :   0.00 (  0%)   0.00 (  0%)   0.01 (  0%)
    720 kB (  0%)
 register information               :   0.03 (  0%)   0.00 (  0%)   0.04 (  0%)
      0 kB (  0%)
 alias analysis                     :   0.01 (  0%)   0.00 (  0%)   0.02 (  0%)
    305 kB (  0%)
 alias stmt walking                 :   0.01 (  0%)   0.00 (  0%)   0.00 (  0%)
      0 kB (  0%)
 preprocessing                      :   0.16 (  0%)   0.12 (  7%)   0.33 (  1%)
   5570 kB (  3%)
 parser (global)                    :   0.16 (  0%)   0.10 (  5%)   0.26 (  1%)
   7359 kB (  4%)
 parser struct body                 :   0.11 (  0%)   0.04 (  2%)   0.18 (  0%)
   4922 kB (  3%)
 parser function body               :   0.03 (  0%)   0.01 (  1%)   0.02 (  0%)
    335 kB (  0%)
 parser inl. func. body             :   0.01 (  0%)   0.01 (  1%)   0.04 (  0%)
    831 kB (  1%)
 parser inl. meth. body             :   0.07 (  0%)   0.04 (  2%)   0.11 (  0%)
   2048 kB (  1%)
 template instantiation             :  31.57 ( 87%)   0.25 ( 14%)  31.79 ( 84%)
  41933 kB ( 25%)
 constant expression evaluation     :   0.08 (  0%)   0.03 (  2%)   0.09 (  0%)
   1401 kB (  1%)
 early inlining heuristics          :   0.02 (  0%)   0.00 (  0%)   0.03 (  0%)
      0 kB (  0%)
 inline parameters                  :   0.04 (  0%)   0.00 (  0%)   0.06 (  0%)
   1987 kB (  1%)
 tree gimplify                      :   0.07 (  0%)   0.02 (  1%)   0.07 (  0%)
   7173 kB (  4%)
 tree eh                            :   0.02 (  0%)   0.01 (  1%)   0.05 (  0%)
    609 kB (  0%)
 tree CFG construction              :   0.04 (  0%)   0.00 (  0%)   0.05 (  0%)
   2452 kB (  1%)
 tree CFG cleanup                   :   0.07 (  0%)   0.01 (  1%)   0.09 (  0%)
      0 kB (  0%)
 tree PHI insertion                 :   0.00 (  0%)   0.01 (  1%)   0.01 (  0%)
      0 kB (  0%)
 tree SSA rewrite                   :   0.01 (  0%)   0.01 (  1%)   0.00 (  0%)
   1153 kB (  1%)
 tree SSA other                     :   0.06 (  0%)   0.00 (  0%)   0.08 (  0%)
    288 kB (  0%)
 tree operand scan                  :   0.03 (  0%)   0.01 (  1%)   0.02 (  0%)
   2456 kB (  1%)
 tree SSA verifier                  :   0.25 (  1%)   0.09 (  5%)   0.35 (  1%)
      0 kB (  0%)
 tree STMT verifier                 :   0.18 (  0%)   0.04 (  2%)   0.32 (  1%)
      0 kB (  0%)
 tree switch lowering               :   0.01 (  0%)   0.01 (  1%)   0.05 (  0%)
      0 kB (  0%)
 callgraph verifier                 :   0.11 (  0%)   0.03 (  2%)   0.14 (  0%)
      0 kB (  0%)
 dominance computation              :   0.34 (  1%)   0.05 (  3%)   0.25 (  1%)
      0 kB (  0%)
 out of ssa                         :   0.03 (  0%)   0.01 (  1%)   0.02 (  0%)
    368 kB (  0%)
 expand vars                        :   0.01 (  0%)   0.00 (  0%)   0.01 (  0%)
    449 kB (  0%)
 expand                             :   0.14 (  0%)   0.03 (  2%)   0.15 (  0%)
   8708 kB (  5%)
 post expand cleanups               :   0.01 (  0%)   0.00 (  0%)   0.01 (  0%)
   1057 kB (  1%)
 varconst                           :   0.00 (  0%)   0.00 (  0%)   0.01 (  0%)
      4 kB (  0%)
 jump                               :   0.00 (  0%)   0.00 (  0%)   0.04 (  0%)
      0 kB (  0%)
 loop init                          :   0.02 (  0%)   0.00 (  0%)   0.02 (  0%)
   1506 kB (  1%)
 loop fini                          :   0.00 (  0%)   0.00 (  0%)   0.01 (  0%)
      0 kB (  0%)
 mode switching                     :   0.00 (  0%)   0.00 (  0%)   0.01 (  0%)
      0 kB (  0%)
 integrated RA                      :   0.25 (  1%)   0.01 (  1%)   0.23 (  1%)
  51144 kB ( 31%)
 LRA non-specific                   :   0.08 (  0%)   0.01 (  1%)   0.14 (  0%)
    336 kB (  0%)
 LRA virtuals elimination           :   0.05 (  0%)   0.00 (  0%)   0.03 (  0%)
    240 kB (  0%)
 LRA reload inheritance             :   0.03 (  0%)   0.00 (  0%)   0.00 (  0%)
      0 kB (  0%)
 LRA create live ranges             :   0.00 (  0%)   0.00 (  0%)   0.04 (  0%)
     48 kB (  0%)
 LRA hard reg assignment            :   0.01 (  0%)   0.00 (  0%)   0.01 (  0%)
      0 kB (  0%)
 reload                             :   0.03 (  0%)   0.01 (  1%)   0.03 (  0%)
      0 kB (  0%)
 thread pro- & epilogue             :   0.13 (  0%)   0.02 (  1%)   0.13 (  0%)
   3270 kB (  2%)
 machine dep reorg                  :   0.00 (  0%)   0.03 (  2%)   0.00 (  0%)
      0 kB (  0%)
 shorten branches                   :   0.05 (  0%)   0.01 (  1%)   0.02 (  0%)
      0 kB (  0%)
 reg stack                          :   0.03 (  0%)   0.00 (  0%)   0.02 (  0%)
      0 kB (  0%)
 final                              :   0.08 (  0%)   0.01 (  1%)   0.16 (  0%)
   3654 kB (  2%)
 symout                             :   0.02 (  0%)   0.00 (  0%)   0.01 (  0%)
     96 kB (  0%)
 uninit var analysis                :   0.03 (  0%)   0.01 (  1%)   0.01 (  0%)
      0 kB (  0%)
 initialize rtl                     :   0.00 (  0%)   0.01 (  1%)   0.02 (  0%)
     12 kB (  0%)
 early local passes                 :   0.01 (  0%)   0.00 (  0%)   0.01 (  0%)
      0 kB (  0%)
 rest of compilation                :   0.34 (  1%)   0.20 ( 11%)   0.56 (  1%)
   5001 kB (  3%)
 unaccounted post reload            :   0.00 (  0%)   0.01 (  1%)   0.00 (  0%)
      0 kB (  0%)
 unaccounted late compilation       :   0.00 (  0%)   0.01 (  1%)   0.01 (  0%)
      0 kB (  0%)
 verify RTL sharing                 :   0.13 (  0%)   0.02 (  1%)   0.22 (  1%)
      0 kB (  0%)
 repair loop structures             :   0.01 (  0%)   0.03 (  2%)   0.00 (  0%)
      0 kB (  0%)
 TOTAL                              :  36.12          1.82         38.03       
 165706 kB
Extra diagnostic checks enabled; compiler may run slowly.
Configure with --enable-checking=release to disable checks.

real    0m38.440s
user    0m36.305s
sys     0m1.976s


Version info of my test compiler:  g++ -v

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin18/9.0.0/lto-wrapper
Target: x86_64-apple-darwin18
Configured with:
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc9/gcc9/work/gcc-9-20181007/configure
--prefix=/opt/local --build=x86_64-apple-darwin18
--enable-languages=c,c++,objc,obj-c++,lto,fortran --libdir=/opt/local/lib/gcc9
--includedir=/opt/local/include/gcc9 --infodir=/opt/local/share/info
--mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-9
--with-local-prefix=/opt/local --with-system-zlib --disable-nls
--program-suffix=-mp-9 --with-gxx-include-dir=/opt/local/include/gcc9/c++/
--with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local
--with-isl=/opt/local --enable-stage1-checking --disable-multilib --enable-lto
--enable-libstdcxx-time --with-build-config=bootstrap-debug
--with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld
--with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket
--disable-tls --with-pkgversion='MacPorts gcc9 9-20181007_1'
--with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
Thread model: posix
gcc version 9.0.0 20181007 (experimental) (MacPorts gcc9 9-20181007_1)


More information about the Gcc-bugs mailing list