summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2018-10-16 17:37:45 +0000
committerTeresa Johnson <tejohnson@google.com>2018-10-16 17:37:45 +0000
commit0bc6b7b81c79a81b977fa5b088dc13177200b380 (patch)
tree37d40db3b9aa0d103b0f4006069bf5b8fc2e2f3c
parent9b6d9f2a6227eb13721fcffabd624ee0cccde4c1 (diff)
downloadbcm5719-llvm-0bc6b7b81c79a81b977fa5b088dc13177200b380.tar.gz
bcm5719-llvm-0bc6b7b81c79a81b977fa5b088dc13177200b380.zip
[LTO] Call InitLLVM from llvm-lto2
Summary: D45602 added this to most tools, including llvm-lto, but not to llvm-lto2. Add it there and test that it works in both lto tools. Reviewers: ruiu Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D53330 llvm-svn: 344631
-rw-r--r--llvm/test/ThinLTO/X86/deadstrip.ll8
-rw-r--r--llvm/tools/llvm-lto2/llvm-lto2.cpp2
2 files changed, 7 insertions, 3 deletions
diff --git a/llvm/test/ThinLTO/X86/deadstrip.ll b/llvm/test/ThinLTO/X86/deadstrip.ll
index ed52222f43a..76dc09e8a9e 100644
--- a/llvm/test/ThinLTO/X86/deadstrip.ll
+++ b/llvm/test/ThinLTO/X86/deadstrip.ll
@@ -8,10 +8,10 @@
; RUN: llvm-lto -exported-symbol=_main -thinlto-action=promote %t1.bc -thinlto-index=%t.index.bc -o - | llvm-lto -exported-symbol=_main -thinlto-action=internalize -thinlto-index %t.index.bc -thinlto-module-id=%t1.bc - -o - | llvm-dis -o - | FileCheck %s
; RUN: llvm-lto -exported-symbol=_main -thinlto-action=promote %t2.bc -thinlto-index=%t.index.bc -o - | llvm-lto -exported-symbol=_main -thinlto-action=internalize -thinlto-index %t.index.bc -thinlto-module-id=%t2.bc - -o - | llvm-dis -o - | FileCheck %s --check-prefix=CHECK2
-; RUN: llvm-lto -exported-symbol=_main -thinlto-action=run %t1.bc %t2.bc
+; RUN: llvm-lto -exported-symbol=_main -thinlto-action=run -stats %t1.bc %t2.bc 2>&1 | FileCheck %s --check-prefix=STATS
; RUN: llvm-nm %t1.bc.thinlto.o | FileCheck %s --check-prefix=CHECK-NM
-; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.out -save-temps \
+; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.out -save-temps -stats \
; RUN: -r %t1.bc,_main,plx \
; RUN: -r %t1.bc,_bar,pl \
; RUN: -r %t1.bc,_dead_func,pl \
@@ -25,7 +25,7 @@
; RUN: -r %t2.bc,_dead_func,l \
; RUN: -r %t2.bc,_another_dead_func,pl \
; RUN: -thinlto-threads=1 \
-; RUN: -debug-only=function-import 2>&1 | FileCheck %s --check-prefix=DEBUG
+; RUN: -debug-only=function-import 2>&1 | FileCheck %s --check-prefix=DEBUG --check-prefix=STATS
; RUN: llvm-dis < %t.out.1.3.import.bc | FileCheck %s --check-prefix=LTO2
; RUN: llvm-dis < %t.out.2.3.import.bc | FileCheck %s --check-prefix=LTO2-CHECK2
; RUN: llvm-nm %t.out.1 | FileCheck %s --check-prefix=CHECK2-NM
@@ -89,6 +89,8 @@
; DEBUG-DAG: Initialize import for 15611644523426561710 (boo)
; DEBUG-DAG: Ignores Dead GUID: 2384416018110111308 (another_dead_func)
+; STATS: 3 function-import - Number of dead stripped symbols in index
+
; Next test the case where Inputs/deadstrip.ll does not get a module index,
; which will cause it to be handled by regular LTO in the new LTO API.
; In that case there are uses of @dead_func in the regular LTO partition
diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp
index 442973f9020..26426367e25 100644
--- a/llvm/tools/llvm-lto2/llvm-lto2.cpp
+++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp
@@ -23,6 +23,7 @@
#include "llvm/LTO/LTO.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/Threading.h"
@@ -388,6 +389,7 @@ static int dumpSymtab(int argc, char **argv) {
}
int main(int argc, char **argv) {
+ InitLLVM X(argc, argv);
InitializeAllTargets();
InitializeAllTargetMCs();
InitializeAllAsmPrinters();
OpenPOWER on IntegriCloud