Skip to content

Commit 0bfafdd

Browse files
committed
UI improvements to the current remote-opt-tool
- Replace `thinlto-remote-opt-tool` with `thinlto-remote-compiler` - Make `thinlto-remote-compiler` a cl::opt
1 parent 8923484 commit 0bfafdd

File tree

9 files changed

+28
-38
lines changed

9 files changed

+28
-38
lines changed

cross-project-tests/dtlto/dtlto-translate-options.ll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,25 @@
2121
; DEFINE: %{triple} = dummy
2222
; DEFINE: %{command} = llvm-lto2 run \
2323
; DEFINE: -thinlto-distributor-arg=%llvm_src_root/utils/dtlto/%{distributor} \
24-
; DEFINE: -thinlto-remote-opt-tool-arg=-Wunused-command-line-argument \
24+
; DEFINE: -thinlto-remote-compiler-arg=-Wunused-command-line-argument \
2525
; DEFINE: @%{triple}.rsp %{extra_flags}
2626

2727

2828
;; Write common arguments to response files.
2929

3030
; RUN: echo "x86_64-unknown-linux-gnu.bc -o x86_64-unknown-linux-gnu.o \
3131
; RUN: -dtlto \
32-
; RUN: -dtlto-remote-opt-tool=%clang \
33-
; RUN: -thinlto-remote-opt-tool-arg=-Werror \
3432
; RUN: -dtlto-distributor=%python \
33+
; RUN: -thinlto-remote-compiler=%clang \
34+
; RUN: -thinlto-remote-compiler-arg=-Werror \
3535
; RUN: -r=x86_64-unknown-linux-gnu.bc,globalfunc1,plx" > x86_64-unknown-linux-gnu.rsp
3636

3737
; RUN: echo "x86_64-pc-windows-msvc.bc -o x86_64-pc-windows-msvc.o \
3838
; RUN: -dtlto \
39-
; RUN: -dtlto-remote-opt-tool=%clang \
40-
; RUN: -thinlto-remote-opt-tool-arg=-Werror \
41-
; RUN: -thinlto-remote-opt-tool-arg=-Wno-override-module \
4239
; RUN: -dtlto-distributor=%python \
40+
; RUN: -thinlto-remote-compiler=%clang \
41+
; RUN: -thinlto-remote-compiler-arg=-Werror \
42+
; RUN: -thinlto-remote-compiler-arg=-Wno-override-module \
4343
; RUN: -r=x86_64-pc-windows-msvc.bc,globalfunc2,plx" > x86_64-pc-windows-msvc.rsp
4444

4545

llvm/include/llvm/LTO/LTO.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,17 +312,14 @@ ThinBackend createInProcessThinBackend(ThreadPoolStrategy Parallelism,
312312
/// LinkerOutputFile is a string that should identify this LTO invocation in
313313
/// the context of a wider build. It's used for naming to aid the user in
314314
/// identifying activity related to a specific LTO invocation.
315-
/// RemoteOptTool specifies the path to a Clang executable to be invoked for the
316-
/// backend jobs.
317315
/// Distributor specifies the path to a process to invoke to manage the backend
318316
/// jobs execution.
319317
/// SaveTemps is a debugging tool that prevents temporary files created by this
320318
/// backend from being cleaned up.
321319
ThinBackend createOutOfProcessThinBackend(
322320
ThreadPoolStrategy Parallelism, IndexWriteCallback OnWrite,
323321
bool ShouldEmitIndexFiles, bool ShouldEmitImportsFiles,
324-
StringRef LinkerOutputFile, StringRef RemoteOptTool, StringRef Distributor,
325-
bool SaveTemps);
322+
StringRef LinkerOutputFile, StringRef Distributor, bool SaveTemps);
326323

327324
/// This ThinBackend writes individual module indexes to files, instead of
328325
/// running the individual backend jobs. This backend is for distributed builds

llvm/lib/LTO/LTO.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,15 @@ cl::list<std::string> AdditionalThinLTODistributorArgs(
9999
"thinlto-distributor-arg",
100100
cl::desc("Additional arguments to pass to the ThinLTO distributor"));
101101

102+
cl::opt<std::string>
103+
ThinLTORemoteCompiler("thinlto-remote-compiler",
104+
cl::desc("Additional arguments to pass to the "
105+
"ThinLTO remote optimization tool"));
106+
102107
cl::list<std::string>
103-
ThinLTORemoteOptToolArgs("thinlto-remote-opt-tool-arg",
104-
cl::desc("Additional arguments to pass to the "
105-
"ThinLTO remote optimization tool"));
108+
ThinLTORemoteCompilerArgs("thinlto-remote-compiler-arg",
109+
cl::desc("Additional arguments to pass to the "
110+
"ThinLTO remote compiler"));
106111
} // namespace llvm
107112

108113
// Computes a unique hash for the Module considering the current list of
@@ -2207,7 +2212,6 @@ class OutOfProcessThinBackend : public CGThinBackend {
22072212
StringSaver Saver{Alloc};
22082213

22092214
SString LinkerOutputFile;
2210-
SString RemoteOptTool;
22112215
SString DistributorPath;
22122216
bool SaveTemps;
22132217

@@ -2240,13 +2244,12 @@ class OutOfProcessThinBackend : public CGThinBackend {
22402244
AddStreamFn AddStream, AddBufferFn AddBuffer,
22412245
lto::IndexWriteCallback OnWrite, bool ShouldEmitIndexFiles,
22422246
bool ShouldEmitImportsFiles, StringRef LinkerOutputFile,
2243-
StringRef RemoteOptTool, StringRef Distributor, bool SaveTemps)
2247+
StringRef Distributor, bool SaveTemps)
22442248
: CGThinBackend(Conf, CombinedIndex, ModuleToDefinedGVSummaries, OnWrite,
22452249
ShouldEmitIndexFiles, ShouldEmitImportsFiles,
22462250
ThinLTOParallelism),
22472251
AddBuffer(std::move(AddBuffer)), LinkerOutputFile(LinkerOutputFile),
2248-
RemoteOptTool(RemoteOptTool), DistributorPath(Distributor),
2249-
SaveTemps(SaveTemps) {}
2252+
DistributorPath(Distributor), SaveTemps(SaveTemps) {}
22502253

22512254
virtual void setup(unsigned MaxTasks, unsigned ReservedTasks) override {
22522255
UID = itostr(sys::Process::getProcessId());
@@ -2311,7 +2314,7 @@ class OutOfProcessThinBackend : public CGThinBackend {
23112314
// approaches should be considered, such as:
23122315
// - A serialization/deserialization format for LTO configuration.
23132316
// - Modifying LLD to be the tool that performs the backend compilations.
2314-
void buildCommonRemoteOptToolOptions() {
2317+
void buildCommonRemoteCompilerOptions() {
23152318
const lto::Config &C = Conf;
23162319
auto &Ops = CodegenOptions;
23172320
llvm::Triple TT{Jobs.front().Triple};
@@ -2349,8 +2352,8 @@ class OutOfProcessThinBackend : public CGThinBackend {
23492352
Ops.push_back("-Wno-unused-command-line-argument");
23502353

23512354
// Forward any supplied options.
2352-
if (!ThinLTORemoteOptToolArgs.empty())
2353-
for (auto &a : ThinLTORemoteOptToolArgs)
2355+
if (!ThinLTORemoteCompilerArgs.empty())
2356+
for (auto &a : ThinLTORemoteCompilerArgs)
23542357
Ops.push_back(a);
23552358
}
23562359

@@ -2372,7 +2375,7 @@ class OutOfProcessThinBackend : public CGThinBackend {
23722375

23732376
// Common command line template.
23742377
JOS.attributeArray("args", [&]() {
2375-
JOS.value(RemoteOptTool);
2378+
JOS.value(ThinLTORemoteCompiler);
23762379

23772380
// Reference to Job::NativeObjectPath.
23782381
JOS.value("-o");
@@ -2454,7 +2457,7 @@ class OutOfProcessThinBackend : public CGThinBackend {
24542457
return make_error<StringError>(BCError + "all triples must be consistent",
24552458
inconvertibleErrorCode());
24562459

2457-
buildCommonRemoteOptToolOptions();
2460+
buildCommonRemoteCompilerOptions();
24582461

24592462
SString JsonFile = sys::path::parent_path(LinkerOutputFile);
24602463
sys::path::append(JsonFile, sys::path::stem(LinkerOutputFile) + "." + UID +
@@ -2502,17 +2505,15 @@ class OutOfProcessThinBackend : public CGThinBackend {
25022505
ThinBackend lto::createOutOfProcessThinBackend(
25032506
ThreadPoolStrategy Parallelism, lto::IndexWriteCallback OnWrite,
25042507
bool ShouldEmitIndexFiles, bool ShouldEmitImportsFiles,
2505-
StringRef LinkerOutputFile, StringRef RemoteOptTool, StringRef Distributor,
2506-
bool SaveTemps) {
2508+
StringRef LinkerOutputFile, StringRef Distributor, bool SaveTemps) {
25072509
auto Func =
25082510
[=](const Config &Conf, ModuleSummaryIndex &CombinedIndex,
25092511
const DenseMap<StringRef, GVSummaryMapTy> &ModuleToDefinedGVSummaries,
25102512
AddStreamFn AddStream, AddBufferFn AddBuffer, FileCache /*Cache*/) {
25112513
return std::make_unique<OutOfProcessThinBackend>(
25122514
Conf, CombinedIndex, Parallelism, ModuleToDefinedGVSummaries,
25132515
AddStream, AddBuffer, OnWrite, ShouldEmitIndexFiles,
2514-
ShouldEmitImportsFiles, LinkerOutputFile, RemoteOptTool,
2515-
Distributor, SaveTemps);
2516+
ShouldEmitImportsFiles, LinkerOutputFile, Distributor, SaveTemps);
25162517
};
25172518
return ThinBackend(Func, Parallelism);
25182519
}

llvm/test/ThinLTO/X86/dtlto/dtlto.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ RUN: mkdir %t/out && cd %t/out
1616
# Define a substitution to share the common DTLTO arguments.
1717
DEFINE: %{command} = llvm-lto2 run ../t1.bc ../t2.bc -o t.o \
1818
DEFINE: -dtlto \
19-
DEFINE: -dtlto-remote-opt-tool=dummy \
2019
DEFINE: -dtlto-distributor=%python \
2120
DEFINE: -thinlto-distributor-arg=%llvm_src_root/utils/dtlto/mock.py \
2221
DEFINE: -thinlto-distributor-arg=../t1.o \

llvm/test/ThinLTO/X86/dtlto/imports.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ RUN: opt -thinlto-bc 1.ll -o 1.bc -O2
1010
# of validate.py will cause a failure as it does not create output files.
1111
DEFINE: %{command} = llvm-lto2 run 0.bc 1.bc -o t.o \
1212
DEFINE: -dtlto \
13-
DEFINE: -dtlto-remote-opt-tool=dummy \
1413
DEFINE: -dtlto-distributor=%python \
1514
DEFINE: -thinlto-distributor-arg=%llvm_src_root/utils/dtlto/validate.py \
1615
DEFINE: -thinlto-distributor-arg=0.bc \

llvm/test/ThinLTO/X86/dtlto/json.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ RUN: opt -thinlto-bc t2.ll -o t2.bc
1111
RUN: not llvm-lto2 run t1.bc t2.bc -o my.output \
1212
RUN: -r=t1.bc,t1,px -r=t2.bc,t2,px \
1313
RUN: -dtlto \
14-
RUN: -dtlto-remote-opt-tool=my_clang.exe \
1514
RUN: -dtlto-distributor=%python \
1615
RUN: -thinlto-distributor-arg=%llvm_src_root/utils/dtlto/validate.py \
17-
RUN: -thinlto-remote-opt-tool-arg=--rota1=10 \
18-
RUN: -thinlto-remote-opt-tool-arg=--rota2=20 \
16+
RUN: -thinlto-remote-compiler=my_clang.exe \
17+
RUN: -thinlto-remote-compiler-arg=--rota1=10 \
18+
RUN: -thinlto-remote-compiler-arg=--rota2=20 \
1919
RUN: -thinlto-distributor-arg=--da1=10 \
2020
RUN: -thinlto-distributor-arg=--da2=10 \
2121
RUN: 2>&1 | FileCheck %s

llvm/test/ThinLTO/X86/dtlto/summary.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ DEFINE: -thinlto-emit-indexes
2020

2121
# Perform DTLTO.
2222
RUN: %{command} -dtlto \
23-
RUN: -dtlto-remote-opt-tool=dummy \
2423
RUN: -dtlto-distributor=%python \
2524
RUN: -thinlto-distributor-arg=%llvm_src_root/utils/dtlto/mock.py \
2625
RUN: -thinlto-distributor-arg=t1.o \

llvm/test/ThinLTO/X86/dtlto/triple.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ RUN: opt t2.ll -o t2.o
1414
# object files supplied using -thinlto-distributor-arg in job order.
1515
RUN: not llvm-lto2 run t1.bc t2.bc -o t.o -save-temps \
1616
RUN: -dtlto \
17-
RUN: -dtlto-remote-opt-tool=dummy \
1817
RUN: -dtlto-distributor=%python \
1918
RUN: -thinlto-distributor-arg=%llvm_src_root/utils/dtlto/mock.py \
2019
RUN: -thinlto-distributor-arg=t1.o \

llvm/tools/llvm-lto2/llvm-lto2.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ static cl::opt<bool>
9999

100100
static cl::opt<bool> DTLTO("dtlto", cl::desc("Perform DTLTO"));
101101

102-
static cl::opt<std::string>
103-
DTLTORemoteOptTool("dtlto-remote-opt-tool",
104-
cl::desc("Specify the remote opt tool for DTLTO"));
105-
106102
static cl::opt<std::string>
107103
DTLTODistributor("dtlto-distributor",
108104
cl::desc("Specify the distributor for DTLTO"));
@@ -372,7 +368,7 @@ static int run(int argc, char **argv) {
372368
Backend = createOutOfProcessThinBackend(
373369
llvm::heavyweight_hardware_concurrency(Threads),
374370
/*OnWrite=*/{}, ThinLTOEmitIndexes, ThinLTOEmitImports, OutputFilename,
375-
DTLTORemoteOptTool, DTLTODistributor, SaveTemps);
371+
DTLTODistributor, SaveTemps);
376372
} else
377373
Backend = createInProcessThinBackend(
378374
llvm::heavyweight_hardware_concurrency(Threads),

0 commit comments

Comments
 (0)