<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/108301>108301</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LLVM's -time-passes / clang -ftime-report output is too long and needs a cutoff or granularity
</td>
</tr>
<tr>
<th>Labels</th>
<td>
enhancement,
llvm:core
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rnk
</td>
</tr>
</table>
<pre>
Consider:
```
$ clang -O2 -c t.cpp -ftime-report |& wc -l
381
$ clang -O2 -c t.cpp -ftime-report |& tail -20
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
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8Vk2P2zYQ_TX0ZWCDovx50MHZrYsCSbNojd5H1EhiliJVDumt_31B2dtuEqfZoGkBQ6KeqZk373EoIrPpHFElVm_E6n6GKfY-VME9zmrfnKs779g0FES5F_JeyL1Yy-vv8qiWoC26DubvFcw1xIUeR4B5G81A80CjDxHE5k6oNTxpmNvLe-W2uAb4pzA3o0Q0FubqSgAA5EJKKUGo7TQWaiXU7jO8uIV_efpf-J45DWM03sEd6p7gGFA_UvhK-teR-ir-DnVvHMGbgE738BB8jbWxJp5h79Ce2fA36nATf8X0h-BbYwk4DQOGMxjX-u-R-jX4r9qP1MDPfm8NMlyv37H-V-hyPI80f4NMzffJ_42sjhg6ivCAzHDnXWu6FDCvylvp_wMLrvmPAR23Pgzwk8u3L1L4F7m-MPueWkw2wi_UobVeww8no6e-3Dcnw_5_6sjPaDwE48PUkDdolEUOUMhPAy9Xt_HN5lP8NgpHH_G6ly4Wi9t783Q99sQEIzITQ-wxQsRHghOFM1gToyXImyxgIPiQOILzEYyLFIijcZ1Qd4CugScC7n2yDTTBjxB7GqANfsgjsIYjRA9DDp2Bl_u2T3FMEQYfCAJhg7WlBRx7w6D9QAxpBOzQuCnPZTQRcGjtOed_6ilQZtAG-j2Ri_YMiQnEWn70iRBrmVmYhlw07RmeeqP7qXYwDPRHb2qTawJOIwVrHGGAkNwkgHHw8ON7oQ5vj--hTsY2vHgp5Nu3v717lqDHEwH7gUA_92JtCQbSPTrDAzyZ2ANCTTFSgOa6Zib5AzVJT14YftYmevDOnnP4p4t-foRCXm3LEnxmoCWeHh2shFqBb8GfKKC1l3pHM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