[PATCH] D23681: [LTO] Add the ability to test -thinlto-emit-imports-files through llvm-lto2
Mehdi AMINI via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 19 09:37:42 PDT 2016
mehdi_amini updated this revision to Diff 68704.
mehdi_amini added a comment.
Rename to ThinLTODistributedIndexes
https://reviews.llvm.org/D23681
Files:
test/ThinLTO/X86/emit_imports.ll
tools/llvm-lto2/llvm-lto2.cpp
Index: tools/llvm-lto2/llvm-lto2.cpp
===================================================================
--- tools/llvm-lto2/llvm-lto2.cpp
+++ tools/llvm-lto2/llvm-lto2.cpp
@@ -33,6 +33,15 @@
static cl::opt<bool> SaveTemps("save-temps", cl::desc("Save temporary files"));
+static cl::opt<bool>
+ ThinLTODistributedIndexes("thinlto-distributed-indexes", cl::init(false),
+ cl::desc("Write out individual index and "
+ "import files for the "
+ "distributed backend case"));
+
+static cl::opt<int> Threads("-thinlto-threads",
+ cl::init(thread::hardware_concurrency()));
+
static cl::list<std::string> SymbolResolutions(
"r",
cl::desc("Specify a symbol resolution: filename,symbolname,resolution\n"
@@ -135,7 +144,12 @@
check(Conf.addSaveTemps(OutputFilename + "."),
"Config::addSaveTemps failed");
- LTO Lto(std::move(Conf));
+ ThinBackend Backend;
+ if (ThinLTODistributedIndexes)
+ Backend = createWriteIndexesThinBackend("", "", true, "");
+ else
+ Backend = createInProcessThinBackend(Threads);
+ LTO Lto(std::move(Conf), std::move(Backend));
bool HasErrors = false;
for (std::string F : InputFilenames) {
Index: test/ThinLTO/X86/emit_imports.ll
===================================================================
--- test/ThinLTO/X86/emit_imports.ll
+++ test/ThinLTO/X86/emit_imports.ll
@@ -12,6 +12,19 @@
; The imports file for Input/emit_imports.ll is empty as it does not import anything.
; RUN: cat %t2.bc.imports | count 0
+; RUN: rm -f %t*.thinlto.bc %t*.bc.imports
+; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o \
+; RUN: -thinlto-distributed-indexes \
+; RUN: -r=%t1.bc,g, \
+; RUN: -r=%t1.bc,f,px \
+; RUN: -r=%t2.bc,g,px
+
+; RUN: cat %t1.bc.imports | count 1
+; RUN: cat %t1.bc.imports | FileCheck %s --check-prefix=IMPORTS1
+
+; The imports file for Input/emit_imports.ll is empty as it does not import anything.
+; RUN: cat %t2.bc.imports | count 0
+
declare void @g(...)
define void @f() {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23681.68704.patch
Type: text/x-patch
Size: 2113 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160819/33121f33/attachment.bin>
More information about the llvm-commits
mailing list