https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87218
Bug ID: 87218 Summary: Extremely long compile time with 710 line Fortran code using -O2 Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: toon at moene dot org Target Milestone: --- Created attachment 44660 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44660&action=edit Source of Fortran routine taking 12+ minutes to compile Attached file compiled with: toon@moene:~/src$ gfortran -v -ftime-report -O2 -S suafn.f90 Using built-in specs. COLLECT_GCC=gfortran OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 8.2.0-4' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 8.2.0 (Debian 8.2.0-4) COLLECT_GCC_OPTIONS='-v' '-ftime-report' '-O2' '-S' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-linux-gnu/8/f951 suafn.f90 -quiet -dumpbase suafn.f90 -mtune=generic -march=x86-64 -auxbase suafn -O2 -version -ftime-report -o suafn.s -fintrinsic-modules-path /usr/lib/gcc/x86_64-linux-gnu/8/finclude GNU Fortran (Debian 8.2.0-4) version 8.2.0 (x86_64-linux-gnu) compiled by GNU C version 8.2.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.20-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU Fortran2008 (Debian 8.2.0-4) version 8.2.0 (x86_64-linux-gnu) compiled by GNU C version 8.2.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.20-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 gives this time report: Time variable usr sys wall GGC phase setup : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( 0%) 182 kB ( 0%) phase parsing : 0.05 ( 0%) 0.00 ( 0%) 0.08 ( 0%) 7841 kB ( 6%) phase opt and generate : 534.57 (100%) 0.45 (100%) 553.90 (100%) 127110 kB ( 94%) dump files : 0.01 ( 0%) 0.00 ( 0%) 0.00 ( 0%) 0 kB ( 0%) callgraph construction : 0.03 ( 0%) 0.00 ( 0%) 0.06 ( 0%) 4906 kB ( 4%) ipa function summary : 0.13 ( 0%) 0.00 ( 0%) 0.09 ( 0%) 5 kB ( 0%) ipa pure const : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( 0%) 0 kB ( 0%) ipa icf : 0.01 ( 0%) 0.00 ( 0%) 0.01 ( 0%) 0 kB ( 0%) ipa free inline summary : 0.01 ( 0%) 0.00 ( 0%) 0.00 ( 0%) 0 kB ( 0%) cfg cleanup : 487.98 ( 91%) 0.04 ( 9%) 503.57 ( 91%) 1045 kB ( 1%) trivially dead code : 0.10 ( 0%) 0.00 ( 0%) 0.10 ( 0%) 0 kB ( 0%) df scan insns : 0.08 ( 0%) 0.03 ( 7%) 0.10 ( 0%) 0 kB ( 0%) df multiple defs : 0.10 ( 0%) 0.00 ( 0%) 0.10 ( 0%) 0 kB ( 0%) df reaching defs : 0.29 ( 0%) 0.01 ( 2%) 0.31 ( 0%) 0 kB ( 0%) df live regs : 1.07 ( 0%) 0.00 ( 0%) 1.14 ( 0%) 0 kB ( 0%) df live&initialized regs : 0.26 ( 0%) 0.00 ( 0%) 0.29 ( 0%) 0 kB ( 0%) df must-initialized regs : 0.01 ( 0%) 0.00 ( 0%) 0.00 ( 0%) 0 kB ( 0%) df use-def / def-use chains : 0.12 ( 0%) 0.00 ( 0%) 0.12 ( 0%) 0 kB ( 0%) df live reg subwords : 0.02 ( 0%) 0.00 ( 0%) 0.02 ( 0%) 0 kB ( 0%) df reg dead/unused notes : 0.79 ( 0%) 0.01 ( 2%) 0.87 ( 0%) 4881 kB ( 4%) register information : 0.19 ( 0%) 0.00 ( 0%) 0.19 ( 0%) 0 kB ( 0%) alias analysis : 0.26 ( 0%) 0.00 ( 0%) 0.26 ( 0%) 8707 kB ( 6%) alias stmt walking : 24.54 ( 5%) 0.16 ( 36%) 27.03 ( 5%) 429 kB ( 0%) register scan : 0.05 ( 0%) 0.00 ( 0%) 0.05 ( 0%) 0 kB ( 0%) rebuild jump labels : 0.06 ( 0%) 0.00 ( 0%) 0.05 ( 0%) 0 kB ( 0%) parser (global) : 0.05 ( 0%) 0.00 ( 0%) 0.08 ( 0%) 7773 kB ( 6%) inline parameters : 0.19 ( 0%) 0.00 ( 0%) 0.11 ( 0%) 516 kB ( 0%) tree gimplify : 0.48 ( 0%) 0.01 ( 2%) 0.59 ( 0%) 6059 kB ( 4%) tree eh : 0.01 ( 0%) 0.00 ( 0%) 0.00 ( 0%) 0 kB ( 0%) tree VRP : 0.04 ( 0%) 0.00 ( 0%) 0.05 ( 0%) 6 kB ( 0%) tree Early VRP : 0.01 ( 0%) 0.00 ( 0%) 0.00 ( 0%) 3 kB ( 0%) tree copy propagation : 0.00 ( 0%) 0.01 ( 2%) 0.00 ( 0%) 0 kB ( 0%) tree PTA : 0.45 ( 0%) 0.01 ( 2%) 0.46 ( 0%) 1290 kB ( 1%) tree SSA rewrite : 0.01 ( 0%) 0.01 ( 2%) 0.00 ( 0%) 2444 kB ( 2%) tree operand scan : 0.02 ( 0%) 0.01 ( 2%) 0.05 ( 0%) 1095 kB ( 1%) dominator optimization : 0.03 ( 0%) 0.01 ( 2%) 0.04 ( 0%) 5347 kB ( 4%) tree SRA : 0.03 ( 0%) 0.00 ( 0%) 0.03 ( 0%) 0 kB ( 0%) tree CCP : 0.02 ( 0%) 0.00 ( 0%) 0.02 ( 0%) 0 kB ( 0%) tree reassociation : 0.01 ( 0%) 0.00 ( 0%) 0.02 ( 0%) 0 kB ( 0%) tree PRE : 0.12 ( 0%) 0.00 ( 0%) 0.12 ( 0%) 3964 kB ( 3%) tree FRE : 0.16 ( 0%) 0.00 ( 0%) 0.17 ( 0%) 2792 kB ( 2%) tree code sinking : 0.01 ( 0%) 0.00 ( 0%) 0.02 ( 0%) 0 kB ( 0%) tree forward propagate : 0.01 ( 0%) 0.00 ( 0%) 0.01 ( 0%) 0 kB ( 0%) tree conservative DCE : 0.03 ( 0%) 0.01 ( 2%) 0.07 ( 0%) 0 kB ( 0%) tree aggressive DCE : 0.02 ( 0%) 0.02 ( 4%) 0.04 ( 0%) 6 kB ( 0%) tree DSE : 0.10 ( 0%) 0.00 ( 0%) 0.10 ( 0%) 2838 kB ( 2%) tree strlen optimization : 8.29 ( 2%) 0.00 ( 0%) 8.66 ( 2%) 312 kB ( 0%) expand : 0.14 ( 0%) 0.02 ( 4%) 0.17 ( 0%) 24881 kB ( 18%) post expand cleanups : 0.01 ( 0%) 0.00 ( 0%) 0.01 ( 0%) 0 kB ( 0%) lower subreg : 0.02 ( 0%) 0.00 ( 0%) 0.01 ( 0%) 0 kB ( 0%) forward prop : 0.35 ( 0%) 0.01 ( 2%) 0.51 ( 0%) 3274 kB ( 2%) CSE : 0.54 ( 0%) 0.00 ( 0%) 0.54 ( 0%) 1759 kB ( 1%) dead code elimination : 0.14 ( 0%) 0.00 ( 0%) 0.13 ( 0%) 0 kB ( 0%) dead store elim1 : 0.24 ( 0%) 0.00 ( 0%) 0.23 ( 0%) 1141 kB ( 1%) dead store elim2 : 0.19 ( 0%) 0.01 ( 2%) 0.19 ( 0%) 1551 kB ( 1%) CPROP : 0.64 ( 0%) 0.00 ( 0%) 0.64 ( 0%) 2882 kB ( 2%) PRE : 0.02 ( 0%) 0.00 ( 0%) 0.02 ( 0%) 0 kB ( 0%) CSE 2 : 0.27 ( 0%) 0.00 ( 0%) 0.28 ( 0%) 736 kB ( 1%) combiner : 1.20 ( 0%) 0.00 ( 0%) 1.27 ( 0%) 5700 kB ( 4%) if-conversion : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( 0%) 0 kB ( 0%) integrated RA : 1.42 ( 0%) 0.01 ( 2%) 1.51 ( 0%) 13454 kB ( 10%) LRA non-specific : 0.33 ( 0%) 0.00 ( 0%) 0.35 ( 0%) 2055 kB ( 2%) LRA virtuals elimination : 0.08 ( 0%) 0.00 ( 0%) 0.07 ( 0%) 264 kB ( 0%) LRA reload inheritance : 0.06 ( 0%) 0.00 ( 0%) 0.05 ( 0%) 309 kB ( 0%) LRA create live ranges : 0.21 ( 0%) 0.00 ( 0%) 0.21 ( 0%) 369 kB ( 0%) LRA hard reg assignment : 0.02 ( 0%) 0.00 ( 0%) 0.02 ( 0%) 0 kB ( 0%) LRA rematerialization : 0.06 ( 0%) 0.00 ( 0%) 0.06 ( 0%) 0 kB ( 0%) reload CSE regs : 0.30 ( 0%) 0.00 ( 0%) 0.30 ( 0%) 2289 kB ( 2%) ree : 0.02 ( 0%) 0.00 ( 0%) 0.03 ( 0%) 0 kB ( 0%) thread pro- & epilogue : 0.04 ( 0%) 0.00 ( 0%) 0.04 ( 0%) 7 kB ( 0%) if-conversion 2 : 0.05 ( 0%) 0.00 ( 0%) 0.05 ( 0%) 0 kB ( 0%) peephole 2 : 0.06 ( 0%) 0.00 ( 0%) 0.06 ( 0%) 1687 kB ( 1%) hard reg cprop : 0.06 ( 0%) 0.00 ( 0%) 0.06 ( 0%) 150 kB ( 0%) scheduling 2 : 1.30 ( 0%) 0.06 ( 13%) 1.51 ( 0%) 9237 kB ( 7%) machine dep reorg : 0.08 ( 0%) 0.00 ( 0%) 0.08 ( 0%) 0 kB ( 0%) reorder blocks : 0.07 ( 0%) 0.00 ( 0%) 0.07 ( 0%) 0 kB ( 0%) shorten branches : 0.09 ( 0%) 0.00 ( 0%) 0.09 ( 0%) 0 kB ( 0%) final : 0.13 ( 0%) 0.00 ( 0%) 0.14 ( 0%) 2362 kB ( 2%) variable output : 0.01 ( 0%) 0.00 ( 0%) 0.00 ( 0%) 9 kB ( 0%) straight-line strength reduction : 0.01 ( 0%) 0.00 ( 0%) 0.00 ( 0%) 0 kB ( 0%) store merging : 0.01 ( 0%) 0.00 ( 0%) 0.01 ( 0%) 698 kB ( 1%) rest of compilation : 0.22 ( 0%) 0.00 ( 0%) 0.22 ( 0%) 4823 kB ( 4%) remove unused locals : 0.02 ( 0%) 0.00 ( 0%) 0.02 ( 0%) 0 kB ( 0%) address taken : 0.01 ( 0%) 0.00 ( 0%) 0.01 ( 0%) 0 kB ( 0%) TOTAL : 534.62 0.45 553.99 135134 kB COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/ LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-ftime-report' '-O2' '-S' '-mtune=generic' '-march=x86-64'