Improving backend compile times with -ftime-trace

I’ve been using Aras’ -ftime-trace to improve compile times in a small (~15K lines) C project.

most of the code is in headers, some of which I precompile, and I only build a couple object files. this is my output with no optimization (-O0) for the larger of the two:

I imagine that splitting some of the larger source files into separate translation units will improve performance just due to parallel jobs and incremental compilation, so that’s probably where I’m headed. but I’m curious about ‘Total Backend’ in this output. what are OptModule, OptFunction, and RunPass doing in O0? I have a decent number of very large functions – could those be causing problems? in general, what can I do at the structural level of my program to improve backend build performance?

LLVM’s code generation pipeline uses the legacy pass manager under the hood. The legacy pass manager has these OptModule / OptFunction trace scopes. My theory is that this is the O0 code generation pipeline, but you could dig a bit more to confirm.