Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions clang/test/Driver/DTLTO/dtlto.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
/// Check DTLTO options are forwarded to the linker.

/// Check that options are forwarded as expected with --thinlto-distributor=.
// RUN: %python %S/filename.py %clang > %t_forward.log
// 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
// RUN: -fthinlto-distributor=d.exe -Werror >>%t_forward.log 2>&1
// RUN: FileCheck %s --input-file=%t_forward.log --check-prefix=FORWARD

// FORWARD: filename.py:[[CLANG:.*]]
// FORWARD: ld.lld
// FORWARD-SAME: "--thinlto-distributor=d.exe"
// FORWARD-SAME: "--thinlto-remote-compiler={{.*}}clang{{[^\"]*}}"
// FORWARD-SAME: "--thinlto-remote-compiler={{.*}}[[CLANG]]"
// FORWARD-SAME: "--thinlto-distributor-arg=a1"
// FORWARD-SAME: "--thinlto-distributor-arg=a2"
// FORWARD-SAME: "--thinlto-distributor-arg=a3"
Expand All @@ -22,30 +24,32 @@
/// 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
// 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: %python %S/filename.py %clang > %t_default.log
// 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
// RUN: -fthinlto-distributor=d.exe -Werror >>%t_default.log 2>&1
// RUN: FileCheck %s --input-file=%t_default.log --check-prefix=DEFAULT \
// RUN: --implicit-check-not=distributor --implicit-check-not=remote-compiler

// DEFAULT: ld.lld
// DEFAULT-SAME: "--thinlto-distributor=d.exe"
// DEFAULT-SAME: "--thinlto-remote-compiler={{[^"]+}}"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebasing via the GitHub GUI seems to have dropped this part of the change. We should be capturing and checking: "--thinlto-remote-compiler={{.*}}[[CLANG]]" as in the other cases. I don't expect this to cause a build bot breakage as the code we have ended up with here is a revert to the original code that has lived upstream for several weeks previous to the latest round of changes.

Copy link
Collaborator Author

@bd1976bris bd1976bris Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in: #159418.


/// Check that nothing is forwarded when the compiler is not in LTO mode, and that
/// appropriate unused option warnings are issued.
// RUN: %python %S/filename.py %clang > %t_noflto.log
// 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 \
// RUN: --implicit-check-not=remote-compiler
// RUN: -fthinlto-distributor=d.exe >>%t_noflto.log 2>&1
// RUN: FileCheck %s --input-file=%t_noflto.log --check-prefix=NOFLTO \
// RUN: --implicit-check-not=distributor --implicit-check-not=remote-compiler

// NOFLTO: warning: argument unused during compilation: '-fthinlto-distributor=d.exe'
// NOFLTO: ld.lld
4 changes: 4 additions & 0 deletions clang/test/Driver/DTLTO/filename.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from pathlib import Path
import sys

print(f"filename.py:{Path(sys.argv[1]).resolve().name}")
29 changes: 17 additions & 12 deletions clang/test/Driver/DTLTO/ps5-dtlto.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
/// Check DTLTO options are forwarded to the linker.

/// Check that options are forwarded as expected with --thinlto-distributor=.
// RUN: %python %S/filename.py %clang > %t_forward.log
// RUN: %clang -flto=thin %s -### --target=x86_64-sie-ps5 \
// RUN: -Xthinlto-distributor=a1 -Xthinlto-distributor=a2,a3 \
// RUN: -fthinlto-distributor=d.exe -Werror 2>&1 | \
// RUN: FileCheck %s --check-prefix=FORWARD
// RUN: -fthinlto-distributor=d.exe -Werror >>%t_forward.log 2>&1
// RUN: FileCheck %s --input-file=%t_forward.log --check-prefix=FORWARD

// FORWARD: filename.py:[[CLANG:.*]]
// FORWARD: prospero-lld
// FORWARD-SAME: "--thinlto-distributor=d.exe"
// FORWARD-SAME: "--thinlto-remote-compiler={{.*}}clang{{[^\"]*}}"
// FORWARD-SAME: "--thinlto-remote-compiler={{.*}}[[CLANG]]"
// FORWARD-SAME: "--thinlto-distributor-arg=a1"
// FORWARD-SAME: "--thinlto-distributor-arg=a2"
// FORWARD-SAME: "--thinlto-distributor-arg=a3"
Expand All @@ -22,27 +24,30 @@
/// that a warning is issued for unused -Xthinlto-distributor options.
// RUN: %clang -flto=thin %s -### --target=x86_64-sie-ps5 \
// 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
// 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: prospero-lld

/// Check the expected arguments are forwarded by default with only
/// --thinlto-distributor=.
// RUN: %python %S/filename.py %clang > %t_default.log
// RUN: %clang -flto=thin %s -### --target=x86_64-sie-ps5 \
// RUN: -fthinlto-distributor=d.exe -Werror 2>&1 | \
// RUN: FileCheck %s --check-prefix=DEFAULT --implicit-check-not=distributor \
// RUN: --implicit-check-not=remote-compiler
// RUN: -fthinlto-distributor=d.exe -Werror >>%t_default.log 2>&1
// RUN: FileCheck %s --input-file=%t_default.log --check-prefix=DEFAULT \
// RUN: --implicit-check-not=distributor --implicit-check-not=remote-compiler

// DEFAULT: filename.py:[[CLANG:.*]]
// DEFAULT: prospero-lld
// DEFAULT-SAME: "--thinlto-distributor=d.exe"
// DEFAULT-SAME: "--thinlto-remote-compiler={{[^"]+}}"
// DEFAULT-SAME: "--thinlto-remote-compiler={{.*}}[[CLANG]]"

/// Check that the arguments are forwarded unconditionally even when the
/// compiler is not in LTO mode.
// RUN: %python %S/filename.py %clang > %t_noflto.log
// RUN: %clang %s -### --target=x86_64-sie-ps5 \
// RUN: -fthinlto-distributor=d.exe -Werror 2>&1 | \
// RUN: FileCheck %s --check-prefix=DEFAULT --implicit-check-not=distributor \
// RUN: --implicit-check-not=remote-compiler
// RUN: -fthinlto-distributor=d.exe -Werror >>%t_noflto.log 2>&1
// RUN: FileCheck %s --input-file=%t_noflto.log --check-prefix=DEFAULT \
// RUN: --implicit-check-not=distributor --implicit-check-not=remote-compiler
Loading