Time report does not show time spent in frontend, optimizer and codegen passes clearly:
- The total time of pass timer group usually over-estimates due to the inclusion of wrapper passes.
- "Code Generation Time" includes both optimizer and codegen passes.
- "LLVM IR Generation Time" only counts IR codegen, but missing out the parsing time.
- "Clang front-end timer" measures the total frontend action execution, but it has the problem of resetting itself prematurely in the case of multiple actions being dispatched because the timer is attached to the global CompilerInstance.
This change adds timers for frontend parsing, IR codegen, optimizer and codegen passes and put them into a new timer group. The timer points are aligned with time trace points for better consistency.
Sample output
===-------------------------------------------------------------------------=== Clang Compilation ===-------------------------------------------------------------------------=== Total Execution Time: 1.1988 seconds (1.1988 wall clock) ---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name --- 0.9365 ( 83.9%) 0.0506 ( 61.3%) 0.9871 ( 82.3%) 0.9871 ( 82.3%) Parse AST 0.1275 ( 11.4%) 0.0180 ( 21.8%) 0.1455 ( 12.1%) 0.1455 ( 12.1%) Optimizer 0.0397 ( 3.6%) 0.0139 ( 16.8%) 0.0536 ( 4.5%) 0.0536 ( 4.5%) CodeGenPasses 0.0127 ( 1.1%) 0.0000 ( 0.0%) 0.0127 ( 1.1%) 0.0127 ( 1.1%) IR Generation 1.1163 (100.0%) 0.0825 (100.0%) 1.1988 (100.0%) 1.1988 (100.0%) Total