The root cause is between 7.1 and 7.2! 7.1 is fast, 7.2 is slow. Bisected, and found it's due to revision 249333 on gcc-7-branch. Here's the commit log and -ftime-report output. Where do we go from here? Thanks! -JasonM ------------------------------------------------------------------------ r249333 | jason | 2017-06-16 19:34:15 -0700 (Fri, 16 Jun 2017) | 6 lines PR c++/81045 - Wrong type-dependence with auto return type. * pt.c (type_dependent_expression_p): An undeduced auto outside the template isn't dependent. * call.c (build_over_call): Instantiate undeduced auto even in a template. ------------------------------------------------------------------------ Execution times (seconds) phase setup : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.01 ( 0%) wall 1385 kB ( 0%) ggc phase parsing :1732.55 (99%) usr 50.00 (97%) sys1782.71 (99%) wall133075852 kB (99%) ggc phase lang. deferred : 10.14 ( 1%) usr 1.33 ( 3%) sys 11.46 ( 1%) wall 494433 kB ( 0%) ggc phase opt and generate : 4.63 ( 0%) usr 0.45 ( 1%) sys 5.09 ( 0%) wall 237946 kB ( 0%) ggc |name lookup : 5.94 ( 0%) usr 1.76 ( 3%) sys 7.75 ( 0%) wall 220059 kB ( 0%) ggc |overload resolution : 25.11 ( 1%) usr 3.98 ( 8%) sys 29.70 ( 2%) wall 2052677 kB ( 2%) ggc garbage collection : 197.31 (11%) usr 8.98 (17%) sys 206.31 (11%) wall 0 kB ( 0%) ggc dump files : 0.04 ( 0%) usr 0.04 ( 0%) sys 0.09 ( 0%) wall 0 kB ( 0%) ggc callgraph construction : 0.77 ( 0%) usr 0.10 ( 0%) sys 0.94 ( 0%) wall 95588 kB ( 0%) ggc callgraph optimization : 0.04 ( 0%) usr 0.02 ( 0%) sys 0.04 ( 0%) wall 64 kB ( 0%) ggc ipa dead code removal : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.01 ( 0%) wall 0 kB ( 0%) ggc ipa inheritance graph : 0.03 ( 0%) usr 0.00 ( 0%) sys 0.01 ( 0%) wall 719 kB ( 0%) ggc ipa inlining heuristics : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall 0 kB ( 0%) ggc cfg construction : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.01 ( 0%) wall 248 kB ( 0%) ggc cfg cleanup : 0.03 ( 0%) usr 0.00 ( 0%) sys 0.03 ( 0%) wall 53 kB ( 0%) ggc trivially dead code : 0.03 ( 0%) usr 0.00 ( 0%) sys 0.01 ( 0%) wall 0 kB ( 0%) ggc df scan insns : 0.11 ( 0%) usr 0.01 ( 0%) sys 0.14 ( 0%) wall 81 kB ( 0%) ggc df live regs : 0.03 ( 0%) usr 0.00 ( 0%) sys 0.04 ( 0%) wall 0 kB ( 0%) ggc df reg dead/unused notes: 0.00 ( 0%) usr 0.00 ( 0%) sys 0.01 ( 0%) wall 2290 kB ( 0%) ggc register information : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall 0 kB ( 0%) ggc alias analysis : 0.09 ( 0%) usr 0.01 ( 0%) sys 0.07 ( 0%) wall 797 kB ( 0%) ggc rebuild jump labels : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall 0 kB ( 0%) ggc preprocessing : 0.57 ( 0%) usr 0.89 ( 2%) sys 1.32 ( 0%) wall 74289 kB ( 0%) ggc parser (global) : 1.22 ( 0%) usr 1.10 ( 2%) sys 2.43 ( 0%) wall 202556 kB ( 0%) ggc parser struct body :1459.61 (84%) usr 29.08 (56%) sys1489.75 (83%) wall122435248 kB (91%) ggc parser enumerator list : 0.05 ( 0%) usr 0.00 ( 0%) sys 0.04 ( 0%) wall 2847 kB ( 0%) ggc parser function body : 0.61 ( 0%) usr 0.18 ( 0%) sys 0.72 ( 0%) wall 29874 kB ( 0%) ggc parser inl. func. body : 0.14 ( 0%) usr 0.07 ( 0%) sys 0.22 ( 0%) wall 10547 kB ( 0%) ggc parser inl. meth. body : 3.86 ( 0%) usr 0.68 ( 1%) sys 4.39 ( 0%) wall 239905 kB ( 0%) ggc template instantiation : 79.00 ( 5%) usr 10.23 (20%) sys 88.55 ( 5%) wall10574851 kB ( 8%) ggc early inlining heuristics: 0.00 ( 0%) usr 0.01 ( 0%) sys 0.00 ( 0%) wall 3 kB ( 0%) ggc inline parameters : 0.05 ( 0%) usr 0.01 ( 0%) sys 0.04 ( 0%) wall 1531 kB ( 0%) ggc tree gimplify : 0.28 ( 0%) usr 0.02 ( 0%) sys 0.31 ( 0%) wall 21735 kB ( 0%) ggc tree eh : 0.02 ( 0%) usr 0.02 ( 0%) sys 0.04 ( 0%) wall 3173 kB ( 0%) ggc tree CFG construction : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.04 ( 0%) wall 4453 kB ( 0%) ggc tree CFG cleanup : 0.02 ( 0%) usr 0.00 ( 0%) sys 0.06 ( 0%) wall 24 kB ( 0%) ggc tree PHI insertion : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.01 ( 0%) wall 732 kB ( 0%) ggc tree SSA rewrite : 0.03 ( 0%) usr 0.00 ( 0%) sys 0.03 ( 0%) wall 2542 kB ( 0%) ggc tree SSA other : 0.03 ( 0%) usr 0.01 ( 0%) sys 0.05 ( 0%) wall 258 kB ( 0%) ggc tree SSA incremental : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.01 ( 0%) wall 0 kB ( 0%) ggc tree operand scan : 1.17 ( 0%) usr 0.04 ( 0%) sys 1.18 ( 0%) wall 6878 kB ( 0%) ggc dominance computation : 0.05 ( 0%) usr 0.00 ( 0%) sys 0.04 ( 0%) wall 0 kB ( 0%) ggc out of ssa : 0.03 ( 0%) usr 0.01 ( 0%) sys 0.03 ( 0%) wall 174 kB ( 0%) ggc expand vars : 0.09 ( 0%) usr 0.01 ( 0%) sys 0.09 ( 0%) wall 3785 kB ( 0%) ggc expand : 0.26 ( 0%) usr 0.02 ( 0%) sys 0.26 ( 0%) wall 22606 kB ( 0%) ggc post expand cleanups : 0.02 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 0%) wall 1994 kB ( 0%) ggc varconst : 0.26 ( 0%) usr 0.08 ( 0%) sys 0.32 ( 0%) wall 164 kB ( 0%) ggc jump : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 0%) wall 0 kB ( 0%) ggc loop init : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 0%) wall 1375 kB ( 0%) ggc mode switching : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 0%) wall 0 kB ( 0%) ggc integrated RA : 0.63 ( 0%) usr 0.01 ( 0%) sys 0.69 ( 0%) wall 53889 kB ( 0%) ggc LRA non-specific : 0.17 ( 0%) usr 0.03 ( 0%) sys 0.19 ( 0%) wall 279 kB ( 0%) ggc LRA virtuals elimination: 0.03 ( 0%) usr 0.00 ( 0%) sys 0.04 ( 0%) wall 1039 kB ( 0%) ggc LRA reload inheritance : 0.01 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 0%) wall 0 kB ( 0%) ggc LRA create live ranges : 0.02 ( 0%) usr 0.00 ( 0%) sys 0.02 ( 0%) wall 137 kB ( 0%) ggc LRA hard reg assignment : 0.02 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall 0 kB ( 0%) ggc reload : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.01 ( 0%) wall 0 kB ( 0%) ggc thread pro- & epilogue : 0.10 ( 0%) usr 0.02 ( 0%) sys 0.03 ( 0%) wall 2859 kB ( 0%) ggc shorten branches : 0.06 ( 0%) usr 0.00 ( 0%) sys 0.07 ( 0%) wall 0 kB ( 0%) ggc reg stack : 0.00 ( 0%) usr 0.01 ( 0%) sys 0.00 ( 0%) wall 0 kB ( 0%) ggc final : 0.14 ( 0%) usr 0.00 ( 0%) sys 0.16 ( 0%) wall 3775 kB ( 0%) ggc symout : 0.06 ( 0%) usr 0.04 ( 0%) sys 0.12 ( 0%) wall 0 kB ( 0%) ggc initialize rtl : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.01 ( 0%) wall 12 kB ( 0%) ggc rest of compilation : 0.15 ( 0%) usr 0.05 ( 0%) sys 0.18 ( 0%) wall 4640 kB ( 0%) ggc TOTAL :1747.32 51.80 1799.28 133809627 kB