Skip to content

Commit ea95125

Browse files
committed
Replace -Xdist with -Xthinlto-distributor=
1 parent 3da7c73 commit ea95125

File tree

7 files changed

+17
-18
lines changed

7 files changed

+17
-18
lines changed

clang/docs/ThinLTO.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,14 @@ DTLTO requires the LLD linker (``-fuse-ld=lld``).
258258
- Specifies the ``<path>`` to the distributor process executable for DTLTO.
259259
- If specified, ThinLTO backend compilations will be distributed by LLD.
260260

261-
``-Xdist <arg>``
261+
``-Xthinlto-distributor=<arg>``
262262
- Pass ``<arg>`` to the distributor process (see ``-fthinlto-distributor=``).
263263
- Can be specified multiple times to pass multiple options.
264+
- Can specify multiple options by separating them with commas.
264265

265266
Examples:
266-
- ``clang -flto=thin -fthinlto-distributor=incredibuild.exe -Xdist --verbose -fuse-ld=lld``
267-
- ``clang -flto=thin -fthinlto-distributor=$(which python) -Xdist incredibuild.py -fuse-ld=lld``
267+
- ``clang -flto=thin -fthinlto-distributor=incredibuild.exe -Xthinlto-distributor=--verbose,--j10 -fuse-ld=lld``
268+
- ``clang -flto=thin -fthinlto-distributor=$(which python) -Xthinlto-distributor=incredibuild.py -fuse-ld=lld``
268269

269270
If ``-fthinlto-distributor=`` is specified Clang supplies the path to a
270271
distributable optimization and code generation tool to LLD. Currently this tool

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ def Xlinker : Separate<["-"], "Xlinker">, Flags<[LinkerInput, RenderAsInput]>,
969969
Visibility<[ClangOption, CLOption, FlangOption]>,
970970
HelpText<"Pass <arg> to the linker">, MetaVarName<"<arg>">,
971971
Group<Link_Group>;
972-
def Xdist : Separate<["-"], "Xdist">, Flags<[LinkOption]>,
972+
def Xthinlto_distributor_EQ : CommaJoined<["-"], "Xthinlto-distributor=">, Flags<[LinkOption]>,
973973
Visibility<[ClangOption, CLOption]>,
974974
HelpText<"Pass <arg> to the ThinLTO distributor">,
975975
MetaVarName<"<arg>">, Group<Link_Group>;

clang/lib/Driver/ToolChains/Gnu.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -546,11 +546,8 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
546546
Args.MakeArgString("--thinlto-remote-opt-tool=" +
547547
Twine(ToolChain.getDriver().getClangProgramPath())));
548548

549-
for (const Arg *A : Args.filtered(options::OPT_Xdist)) {
550-
A->claim();
551-
CmdArgs.push_back(Args.MakeArgString("-mllvm=-thinlto-distributor-arg=" +
552-
Twine(A->getValue())));
553-
}
549+
for (auto A : Args.getAllArgValues(options::OPT_Xthinlto_distributor_EQ))
550+
CmdArgs.push_back(Args.MakeArgString("-mllvm=-thinlto-distributor-arg=" + A));
554551
}
555552

556553
if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle))

clang/test/Driver/DTLTO/dtlto.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// REQUIRES: lld
44

55
// RUN: echo "--target=x86_64-linux-gnu \
6-
// RUN: -Xdist distarg1 \
7-
// RUN: -Xdist distarg2 \
6+
// RUN: -Xthinlto-distributor=distarg1 \
7+
// RUN: -Xthinlto-distributor=distarg2,distarg3 \
88
// RUN: -fuse-ld=lld" > %t.rsp
99

1010

@@ -17,16 +17,17 @@
1717
// CHECK-SAME: "--thinlto-remote-opt-tool={{.*}}clang
1818
// CHECK-SAME: "-mllvm=-thinlto-distributor-arg=distarg1"
1919
// CHECK-SAME: "-mllvm=-thinlto-distributor-arg=distarg2"
20+
// CHECK-SAME: "-mllvm=-thinlto-distributor-arg=distarg3"
2021

2122

2223
/// Check that options are not added without --thinlto-distributor= and
23-
/// that there is an unused option warning issued for -Xdist options. We
24+
/// that there is an unused option warning issued for -Xthinlto-distributor= options. We
2425
/// specify -flto here as these options should be unaffected by it.
2526
// RUN: %clang -### @%t.rsp -flto=thin %s 2>&1 | \
2627
// RUN: FileCheck %s --check-prefixes=NONE,NOMORE --implicit-check-not=warning
2728

28-
// NONE: warning: argument unused during compilation: '-Xdist distarg1'
29-
// NONE: warning: argument unused during compilation: '-Xdist distarg2'
29+
// NONE: warning: argument unused during compilation: '-Xthinlto-distributor=distarg1'
30+
// NONE: warning: argument unused during compilation: '-Xthinlto-distributor=distarg2,distarg3'
3031
// NONE: ld.lld
3132
// NOMORE-NOT: --thinlto-distributor=
3233
// NOMORE-NOT: --thinlto-remote-opt-tool=

cross-project-tests/dtlto/archive-thin.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# RUN: %t.dir/foo.a %t.dir/lib/bar.a ../_start.a %t.dir/cat.a -Wl,--whole-archive,../dog.a \
2727
# RUN: -flto=thin \
2828
# RUN: -fthinlto-distributor=%python \
29-
# RUN: -Xdist %llvm_src_root/utils/dtlto/local.py \
29+
# RUN: -Xthinlto-distributor=%llvm_src_root/utils/dtlto/local.py \
3030
# RUN: --save-temps \
3131
# RUN: -fuse-ld=lld \
3232
# RUN: -nostdlib \

cross-project-tests/dtlto/dtlto.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
// RUN: %clang --target=x86_64-linux-gnu %s -shared -flto=thin \
1010
// RUN: -fthinlto-distributor=%python \
11-
// RUN: -Xdist %llvm_src_root/utils/dtlto/local.py \
11+
// RUN: -Xthinlto-distributor=%llvm_src_root/utils/dtlto/local.py \
1212
// RUN: --save-temps \
1313
// RUN: -fuse-ld=lld \
1414
// RUN: -nostdlib \

lld/docs/DTLTO.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ properties of the distribution system (as such additional input/output files may
4444
not be pushed to or fetched from distribution system nodes correctly). If such
4545
options are required, then the distributor can be modified to accept switches
4646
that specify additional input/output dependencies, and
47-
``-Xdist``/``-thinlto-distributor-arg=`` can be used to pass such options through
48-
to the distributor.
47+
``-mllvm -thinlto-distributor-arg=`` can be used to pass such options through to
48+
the distributor.
4949

5050
Some LLD LTO options (e.g., ``--lto-sample-profile=<file>``) are supported.
5151
Currently, other options are silently accepted but do not have the desired

0 commit comments

Comments
 (0)