Before this patch, jit.dg/test-benchmark.c at optlevel 0, 100 iterations showed "rest of compilation" as taking a significant chunk of time:
rest of compilation : 1.53 (64%) usr 0.06 (32%) sys 1.60 (27%) wall 1388 kB ( 6%) ggc This turned out to be almost entirely spent inside initialize_rtl; adding a TV_INITIALIZE_RTL for this indicates this cost clearly: initialize rtl : 1.46 (61%) usr 0.01 ( 5%) sys 1.42 (24%) wall 1156 kB ( 5%) ggc rest of compilation : 0.05 ( 2%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall 232 kB ( 1%) ggc I'm experimenting with a followup patch to amortize this away by making RTL initialization a one-time deal, but in the meantime, this patch adds accounting for it. OK for trunk? (assuming bootstrap and testing) gcc/ChangeLog: * timevar.def (TV_INITIALIZE_RTL): New. * toplev.c (initialize_rtl): Use an auto_timevar to account this function's time to TV_INITIALIZE_RTL. --- gcc/timevar.def | 1 + gcc/toplev.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/gcc/timevar.def b/gcc/timevar.def index 711bbed..cf8f37d 100644 --- a/gcc/timevar.def +++ b/gcc/timevar.def @@ -268,6 +268,7 @@ DEFTIMEVAR (TV_PLUGIN_RUN , "plugin execution") DEFTIMEVAR (TV_GIMPLE_SLSR , "straight-line strength reduction") DEFTIMEVAR (TV_VTABLE_VERIFICATION , "vtable verification") DEFTIMEVAR (TV_TREE_UBSAN , "tree ubsan") +DEFTIMEVAR (TV_INITIALIZE_RTL , "initialize rtl") /* Everything else in rest_of_compilation not included above. */ DEFTIMEVAR (TV_EARLY_LOCAL , "early local passes") diff --git a/gcc/toplev.c b/gcc/toplev.c index 3c1ba38..54eefcd 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1818,6 +1818,8 @@ static int rtl_initialized; void initialize_rtl (void) { + auto_timevar tv (TV_INITIALIZE_RTL); + /* Initialization done just once per compilation, but delayed till code generation. */ if (!rtl_initialized) -- 1.8.5.3