Skip to content

LLVM's -time-passes / clang -ftime-report output is too long and needs a cutoff or granularity #108301

@rnk

Description

@rnk

Consider:

$ clang -O2 -c t.cpp  -ftime-report |& wc -l
381

$ clang -O2 -c t.cpp  -ftime-report |& tail -20
.... lots of lines
   0.0000 (  0.0%)   0.0000 (  0.1%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Assumption Cache Tracker
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Machine Branch Probability Analysis
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Profile summary info
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Scoped NoAlias Alias Analysis
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Type-Based Alias Analysis
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Target Pass Configuration
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Target Transform Information
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Default Regalloc Eviction Advisor
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Default Regalloc Priority Advisor
   0.0031 (100.0%)   0.0045 (100.0%)   0.0077 (100.0%)   0.0077 (100.0%)  Total
...

These passes that take very little time are just not interesting, and we should drop them from the list to make the time-report output more readable. This comes up again and again internally, where we frequently use -ftime-report to identify which pass is exhibiting superlinear runtime in PGO/LTO builds.

LLVM should have some configurable mechanism with a better default that reduces this output to only show the top 10 passes, passes that take less than 5% of overall pass pipeline time, or something else. The time trace tool has -ftime-trace-granularity= which solves a similar but different problem for -ftime-trace.

cc @slackito @aeubanks @alinas

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImproving things as opposed to bug fixing, e.g. new or missing featurellvm:core

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions