The information collected when requested by -time-passes is only printed when llvm_shutdown is called at the moment. This means that when linking against the LTO library dynamically and using the C interface, it is not possible to see the timing information, because llvm_shutdown cannot be called. This changes modifies the LTO code generation functions for both regular LTO and thin LTO to explicitly print and reset the timing information.
I have tested that this works with our proprietary linker. However, as this relies on a specific method of building and linking against the LTO library, I'm not sure how or if this can be tested in the LLVM testsuite. Any suggestions would be appreciated.
Doxygen
Also the name does not carry the fact that timers are reset.