mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-15 07:39:31 +00:00
[LTO] Print time-passes information at conclusion of LTO codegen
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 change 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. Reviewed by: mehdi_amini Differential Revision: https://reviews.llvm.org/D32803 llvm-svn: 303152
This commit is contained in:
parent
66886e6d12
commit
2de1ac6a79
@ -98,6 +98,9 @@ private:
|
||||
// Create wrappers for C Binding types (see CBindingWrapping.h).
|
||||
DEFINE_STDCXX_CONVERSION_FUNCTIONS(legacy::PassManagerBase, LLVMPassManagerRef)
|
||||
|
||||
/// If -time-passes has been specified, report the timings immediately and then
|
||||
/// reset the timers to zero.
|
||||
void reportAndResetTimings();
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -12,6 +12,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/IR/LegacyPassManager.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/IR/IRPrintingPasses.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/LegacyPassManagers.h"
|
||||
@ -465,6 +466,11 @@ public:
|
||||
// null. It may be called multiple times.
|
||||
static void createTheTimeInfo();
|
||||
|
||||
// print - Prints out timing information and then resets the timers.
|
||||
void print() {
|
||||
TG.print(*CreateInfoOutputFile());
|
||||
}
|
||||
|
||||
/// getPassTimer - Return the timer for the specified pass if it exists.
|
||||
Timer *getPassTimer(Pass *P) {
|
||||
if (P->getAsPMDataManager())
|
||||
@ -1752,6 +1758,13 @@ Timer *llvm::getPassTimer(Pass *P) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/// If timing is enabled, report the times collected up to now and then reset
|
||||
/// them.
|
||||
void llvm::reportAndResetTimings() {
|
||||
if (TheTimeInfo)
|
||||
TheTimeInfo->print();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// PMStack implementation
|
||||
//
|
||||
|
@ -597,6 +597,7 @@ bool LTOCodeGenerator::compileOptimized(ArrayRef<raw_pwrite_stream *> Out) {
|
||||
// If statistics were requested, print them out after codegen.
|
||||
if (llvm::AreStatisticsEnabled())
|
||||
llvm::PrintStatistics();
|
||||
reportAndResetTimings();
|
||||
|
||||
finishOptimizationRemarks();
|
||||
|
||||
|
@ -1024,4 +1024,5 @@ void ThinLTOCodeGenerator::run() {
|
||||
// If statistics were requested, print them out now.
|
||||
if (llvm::AreStatisticsEnabled())
|
||||
llvm::PrintStatistics();
|
||||
reportAndResetTimings();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user