[PATCH] D17302: [LTO] Support Statistics

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 16 13:46:28 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL261013: [LTO] Support Statistics (authored by anemet).

Changed prior to commit:
  http://reviews.llvm.org/D17302?vs=48094&id=48102#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17302

Files:
  llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
  llvm/trunk/test/tools/lto/print-stats.ll

Index: llvm/trunk/test/tools/lto/print-stats.ll
===================================================================
--- llvm/trunk/test/tools/lto/print-stats.ll
+++ llvm/trunk/test/tools/lto/print-stats.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as %s -o %t.o
+; RUN: %ld64 -lto_library %llvmshlibdir/libLTO.dylib -arch x86_64 -dylib -mllvm -stats -o %t.dylib %t.o 2>&1 | FileCheck --check-prefix=STATS %s
+; RUN: %ld64 -lto_library %llvmshlibdir/libLTO.dylib -arch x86_64 -dylib -o %t.dylib %t.o 2>&1 | FileCheck --check-prefix=NO_STATS %s
+
+target triple = "x86_64-apple-macosx10.8.0"
+
+; STATS: Statistics Collected
+; NO_STATS-NOT: Statistics Collected
Index: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
===================================================================
--- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
+++ llvm/trunk/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 @@
                    RelocModel, CodeModel::Default, CGOptLevel, FileType,
                    ShouldRestoreGlobalsLinkage);
 
+  // If statistics were requested, print them out after codegen.
+  if (llvm::AreStatisticsEnabled())
+    llvm::PrintStatistics();
+
   return true;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17302.48102.patch
Type: text/x-patch
Size: 1446 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160216/da6c636e/attachment.bin>


More information about the llvm-commits mailing list