[llvm] r293908 - [ThinLTO] PrintStatistics when we exit early for thinlto-index-only

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 2 09:33:54 PST 2017


Author: tejohnson
Date: Thu Feb  2 11:33:53 2017
New Revision: 293908

URL: http://llvm.org/viewvc/llvm-project?rev=293908&view=rev
Log:
[ThinLTO] PrintStatistics when we exit early for thinlto-index-only

Summary:
This is necessary to get stats from the ThinLink printed before the
early exit when compiling in a distributed build.

Reviewers: mehdi_amini

Subscribers: Prazek, llvm-commits

Differential Revision: https://reviews.llvm.org/D29461

Modified:
    llvm/trunk/test/tools/gold/X86/stats.ll
    llvm/trunk/tools/gold/gold-plugin.cpp

Modified: llvm/trunk/test/tools/gold/X86/stats.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/stats.ll?rev=293908&r1=293907&r2=293908&view=diff
==============================================================================
--- llvm/trunk/test/tools/gold/X86/stats.ll (original)
+++ llvm/trunk/test/tools/gold/X86/stats.ll Thu Feb  2 11:33:53 2017
@@ -5,6 +5,13 @@
 ; RUN:    -m elf_x86_64 \
 ; RUN:    -plugin-opt=-stats %t.o -o %t2 2>&1 | FileCheck %s
 
+; RUN: llvm-as %s -o %t.o
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so  -shared \
+; RUN:    -m elf_x86_64 \
+; RUN:    -plugin-opt=thinlto \
+; RUN:    -plugin-opt=thinlto-index-only \
+; RUN:    -plugin-opt=-stats %t.o -o %t2 2>&1 | FileCheck %s
+
 ; CHECK: Statistics Collected
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=293908&r1=293907&r2=293908&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Thu Feb  2 11:33:53 2017
@@ -12,6 +12,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/ADT/Statistic.h"
 #include "llvm/Bitcode/BitcodeReader.h"
 #include "llvm/Bitcode/BitcodeWriter.h"
 #include "llvm/CodeGen/CommandFlags.h"
@@ -844,6 +845,8 @@ static ld_plugin_status allSymbolsReadHo
     return LDPS_OK;
 
   if (options::thinlto_index_only) {
+    if (llvm::AreStatisticsEnabled())
+      llvm::PrintStatistics();
     cleanup_hook();
     exit(0);
   }




More information about the llvm-commits mailing list