-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[DTLTO][Clang] Add support for Integrated Distributed ThinLTO #147265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
737bb8c
af66910
fd51379
f2c6b8d
cdce7ff
75289e7
bb2f7d3
00321cf
fb25cda
44abe76
820a50d
60e87c9
c961cc0
93dda6f
c8e8305
1b0257c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// REQUIRES: lld | ||
|
||
/// 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 | ||
ilovepi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// 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" | ||
|
||
|
||
/// 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confused about the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes that was the intent. I have now used a common response file for all There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For clang driver, prefer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MaskRay done. Thanks. |
||
|
||
// 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe better to put these in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. I have also used the same set of implicit-check-not arguments in each of the FileCheck invocations (via a response file) to reduce the size of the test and improve readability. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @teresajohnson I have now removed the use of response files and implemented (judiciously) @MaskRay's suggestion of using |
||
// NOMORE-NOT: remote-compiler | ||
|
||
|
||
/// 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 | ||
|
||
// DEFAULT: ld.lld | ||
// DEFAULT-SAME: "--thinlto-distributor=dist.exe" | ||
// DEFAULT-SAME: "--thinlto-remote-compiler={{.*}}clang |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not be consistent with the other LTO options though, which are added in addLTOOptions? The same argument could be made for those (and maybe they should be sent unconditionally, but that seems like a separate discussion).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies - we’ve recently started setting LTO options unconditionally in the PS5 driver, and I carried that pattern over here without fully reconsidering it. As you pointed out, the issue is broader than just the DTLTO options and deserves separate handling.
It’s also unclear whether setting options unconditionally is the right long-term approach. An alternative could be to pass a flag to the linker, allowing it to emit a warning if LTO is being performed but the Clang driver wasn't explicitly invoked in LTO mode.
In any case, I’ve moved the DTLTO option handling into
addLTOOptions
as you suggested. Thanks for the guidance.