Skip to content

Commit

Permalink
[ThinLTO] PrintStatistics when we exit early for thinlto-index-only
Browse files Browse the repository at this point in the history
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293908 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
teresajohnson committed Feb 2, 2017
1 parent bb3b201 commit 8ffb6b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/tools/gold/X86/stats.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions tools/gold/gold-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
//
//===----------------------------------------------------------------------===//

#include "llvm/ADT/Statistic.h"
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/Bitcode/BitcodeWriter.h"
#include "llvm/CodeGen/CommandFlags.h"
Expand Down Expand Up @@ -844,6 +845,8 @@ static ld_plugin_status allSymbolsReadHook() {
return LDPS_OK;

if (options::thinlto_index_only) {
if (llvm::AreStatisticsEnabled())
llvm::PrintStatistics();
cleanup_hook();
exit(0);
}
Expand Down

0 comments on commit 8ffb6b1

Please sign in to comment.