[clang] [llvm] [DTLTO][Clang] Add support for Integrated Distributed ThinLTO (PR #147265)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 15 01:18:55 PDT 2025


================
@@ -2,42 +2,47 @@
 
 /// Check DTLTO options are forwarded to the linker.
 
-// RUN: echo "--target=x86_64-linux-gnu \
-// RUN:   -Xthinlto-distributor=distarg1 \
-// RUN:   -Xthinlto-distributor=distarg2,distarg3 \
-// RUN:   -fuse-ld=lld" > %t.rsp
-
 /// Check that options are forwarded as expected with --thinlto-distributor=.
-// RUN: %clang -### @%t.rsp -fthinlto-distributor=dist.exe %s 2>&1 | \
-// RUN:   FileCheck %s --implicit-check-not=warning
-
-// CHECK: ld.lld
-// CHECK-SAME: "--thinlto-distributor=dist.exe"
-// CHECK-SAME: "--thinlto-remote-compiler={{.*}}clang
-// CHECK-SAME: "--thinlto-distributor-arg=distarg1"
-// CHECK-SAME: "--thinlto-distributor-arg=distarg2"
-// CHECK-SAME: "--thinlto-distributor-arg=distarg3"
-
+// RUN: %clang -flto=thin %s -### -fuse-ld=lld --target=x86_64-linux-gnu \
+// RUN:   -Xthinlto-distributor=a1 -Xthinlto-distributor=a2,a3 \
+// RUN:   -fthinlto-distributor=d.exe -Werror 2>&1 | \
+// RUN:   FileCheck %s --check-prefix=FORWARD
+
+// FORWARD: ld.lld
+// FORWARD-SAME: "--thinlto-distributor=d.exe"
+// FORWARD-SAME: "--thinlto-remote-compiler={{.*}}clang{{[^\"]*}}"
+// FORWARD-SAME: "--thinlto-distributor-arg=a1"
+// FORWARD-SAME: "--thinlto-distributor-arg=a2"
+// FORWARD-SAME: "--thinlto-distributor-arg=a3"
 
 /// Check that options are not added without --thinlto-distributor= and
-/// that there is an unused option warning issued for -Xthinlto-distributor=
-/// options. We specify -flto here as these options should be unaffected by it.
-// RUN: %clang -### @%t.rsp -flto=thin %s 2>&1 | \
-// RUN:   FileCheck %s --check-prefixes=NONE,NOMORE --implicit-check-not=warning
-
-// NONE: warning: argument unused during compilation: '-Xthinlto-distributor=distarg1'
-// NONE: warning: argument unused during compilation: '-Xthinlto-distributor=distarg2,distarg3'
-// NONE:     ld.lld
-// NOMORE-NOT: distributor
-// NOMORE-NOT: remote-compiler
+/// that a warning is issued for unused -Xthinlto-distributor options.
+// RUN: %clang -flto=thin %s -### -fuse-ld=lld --target=x86_64-linux-gnu \
+// RUN:   -Xthinlto-distributor=a1 -Xthinlto-distributor=a2,a3 2>&1 | \
+// RUN:   FileCheck %s --check-prefix=NODIST --implicit-check-not=distributor \
+// RUN:     --implicit-check-not=remote-compiler
 
+// NODIST: warning: argument unused during compilation: '-Xthinlto-distributor=a1'
+// NODIST: warning: argument unused during compilation: '-Xthinlto-distributor=a2,a3'
+// NODIST: ld.lld
 
 /// Check the expected arguments are forwarded by default with only
 /// --thinlto-distributor=.
-// RUN: %clang --target=x86_64-linux-gnu -fthinlto-distributor=dist.exe \
-// RUN:   -fuse-ld=lld -Werror -### %s 2>&1 | \
-// RUN:   FileCheck %s --check-prefixes=DEFAULT,NOMORE
+// RUN: %clang -flto=thin %s -### -fuse-ld=lld --target=x86_64-linux-gnu \
+// RUN:   -fthinlto-distributor=d.exe -Werror 2>&1 | \
+// RUN:   FileCheck %s --check-prefix=DEFAULT --implicit-check-not=distributor \
+// RUN:     --implicit-check-not=remote-compiler
 
 // DEFAULT: ld.lld
-// DEFAULT-SAME: "--thinlto-distributor=dist.exe"
-// DEFAULT-SAME: "--thinlto-remote-compiler={{.*}}clang
+// DEFAULT-SAME: "--thinlto-distributor=d.exe"
+// DEFAULT-SAME: "--thinlto-remote-compiler={{.*}}clang{{[^\"]*}}"
+
+/// Check that nothing is forwarded when the compiler is not in LTO mode, and that
+/// appropriate unused option warnings are issued.
+// RUN: %clang %s -### -fuse-ld=lld --target=x86_64-linux-gnu \
+// RUN:   -fthinlto-distributor=d.exe 2>&1 | \
+// RUN:   FileCheck %s --check-prefix=NOFLTO --implicit-check-not=distributor \
----------------
bd1976bris wrote:

Thanks for the input @ilovepi and @MaskRay. I prefer the same style as @MaskRay so I'll be sticking to that.

https://github.com/llvm/llvm-project/pull/147265


More information about the llvm-commits mailing list