[patch] timevar TLC

Steven Bosscher stevenb.gcc@gmail.com
Tue Aug 14 19:06:00 GMT 2012


On Tue, Aug 14, 2012 at 8:40 PM, Diego Novillo <dnovillo@google.com> wrote:
> On 12-08-14 14:26 , Steven Bosscher wrote:
>>
>> Hello,
>>
>> Many unused timevars, many timevars that measure completely different
>> passes, passes with the wrong timevar, etc.
>>
>> Time for a bit of maintenance / janitorial.
>>
>> Bootstrapped&tested on powerpc64-unknown-linux-gnu. OK for trunk?
>>
>> Ciao!
>> Steven
>>
>>         * timevar.def (TV_VARPOOL, TV_WHOPR_WPA_LTRANS_EXEC, TV_LIFE,
>>         TV_LIFE_UPDATE, TV_DF_UREC, TV_INLINE_HEURISTICS,
>>         TV_TREE_LINEAR_TRANSFORM, TV_TREE_LOOP_INIT, TV_TREE_LOOP_FINI,
>>         TV_VPT, TV_LOCAL_ALLOC, TV_GLOBAL_ALLOC, TV_SEQABSTR): Remove.
>>         (TV_IPA_INLINING, TV_FLATTEN_INLINING, TV_EARLY_INLINING,
>>         TV_INLINE_PARAMETERS, TV_LOOP_INIT, TV_LOOP_FINI): New.
>>         * timevar.c (timevar_print): Make printing width of timevar names
>>         more flexible, but enforce maximum length.
>>         * ipa-inline.c (pass_early_inline): Use TV_EARLY_INLINING.
>>         (pass_ipa_inline): Use TV_IPA_INLINING.
>>         * ipa-inline-analysis.c (pass_inline_parameters): Use
>>         TV_INLINE_HEURISTICS.
>>         * tree-ssa-loop.c (pass_tree_loop_init): No timevar for wrapper
>> pass.
>>         (pass_tree_loop_done): Likewise.
>>         * final.c (pass_shorten_branches): Use TV_SHORTEN_BRANCH.
>>         * loop-init.c (loop_optimizer_init): Push/pop TV_LOOP_INIT.
>>         (loop_optimizer_finalize): Push/pop TV_LOOP_FINI.
>
>
> Looks fine, except:
>
>> @@ -505,6 +507,16 @@ timevar_print (FILE *fp)
>>       TIMEVAR.  */
>>    start_time = now;
>>
>> +#ifdef ENABLE_CHECKING
>> +  /* Pester those who add timevars with too long names.  */
>> +  for (id = 0; id < (unsigned int) TIMEVAR_LAST; ++id)
>> +    {
>> +      struct timevar_def *tv = &timevars[(timevar_id_t) id];
>> +      if ((timevar_id_t) id != TV_TOTAL && tv->used)
>> +       gcc_assert (strlen (tv->name) <= name_width);
>> +    }
>> +#endif
>
>
> I'm not liking this too much.  I would rather do truncation or wrapping.
> Not ICEing.  And we'd do this all the time, not just with checking enabled.

Wrapping would be bad, it'd break scripts that parse the -ftime-report output.
Truncation is a bit silly, too: If the name is always truncated, why
have the long name in the first place?

I chose for this gcc_assert solution to make absolutely sure nobody
can add a timevar with an overlong name.


> I suppose this works with -ftime-report right? (I'm thinking about the new
> code that emits phase-level timers).

Yes, I've been using -ftime-report a lot for PR54146, and the output
format was itching...

Ciao!
Steven



More information about the Gcc-patches mailing list