summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2016-02-16 21:41:51 +0000
committerAdam Nemet <anemet@apple.com>2016-02-16 21:41:51 +0000
commit106fedab6f7ea001eb95e7f42cfc67b046ec3049 (patch)
tree3b76c36ab4001c1062ac17c0bd3cd377303c1a06 /llvm/lib/LTO
parent6e0d5f573cb7f5b065ad8bbe76e1d2c0190d3101 (diff)
downloadbcm5719-llvm-106fedab6f7ea001eb95e7f42cfc67b046ec3049.tar.gz
bcm5719-llvm-106fedab6f7ea001eb95e7f42cfc67b046ec3049.zip
[LTO] Support Statistics
Summary: I thought -Xlinker -mllvm -Xlinker -stats worked at some point but maybe it never did. For clang, I believe that stats are printed from cc1_main. This patch also prints them for LTO, specifically right after codegen happens. I only looked at the C API for LTO briefly to see if this is a good place. Probably there are still cases where this wouldn't be printed but it seems to be working for the common case. I also experimented putting this in the LTOCodeGenerator destructor but that didn't trigger for me because ld64 does not destroy the LTOCodeGenerator. Reviewers: dexonsmith, joker.eph Subscribers: rafael, joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D17302 llvm-svn: 261013
Diffstat (limited to 'llvm/lib/LTO')
-rw-r--r--llvm/lib/LTO/LTOCodeGenerator.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp
index 70626682d55..5d173b262dc 100644
--- a/llvm/lib/LTO/LTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/LTO/LTOCodeGenerator.h"
+#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Analysis/Passes.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
@@ -553,6 +554,10 @@ bool LTOCodeGenerator::compileOptimized(ArrayRef<raw_pwrite_stream *> Out) {
RelocModel, CodeModel::Default, CGOptLevel, FileType,
ShouldRestoreGlobalsLinkage);
+ // If statistics were requested, print them out after codegen.
+ if (llvm::AreStatisticsEnabled())
+ llvm::PrintStatistics();
+
return true;
}
OpenPOWER on IntegriCloud