-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[DTLTO][PS4,PS5] Suppress system headers directory warning #167685
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
[DTLTO][PS4,PS5] Suppress system headers directory warning #167685
Conversation
The PS5 driver warns under various circumstances if SDK directories can't be found. This warning is not applicable in ThinLTO codegen mode (-fthinlto-index=). Suppress it. The motivation for doing this is that we sometimes see this warning emitted when DTLTO invokes the compiler on a remote machine to do the LTO backend compilations (with -fthinlto-index=). Internal Ref: TOOLCHAIN-20592
|
@llvm/pr-subscribers-clang-driver @llvm/pr-subscribers-clang Author: Ben Dunbobbin (bd1976bris) ChangesOur driver warns under various circumstances if SDK directories can't be found. This warning is not applicable in ThinLTO codegen mode (-fthinlto-index=). Suppress it. The motivation for doing this is that we sometimes see this warning emitted when DTLTO invokes the compiler on a remote machine to do the LTO backend compilations (with -fthinlto-index=). Internal Ref: TOOLCHAIN-20592 Full diff: https://github.com/llvm/llvm-project/pull/167685.diff 3 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/PS4CPU.cpp b/clang/lib/Driver/ToolChains/PS4CPU.cpp
index 6fe18aa4cceba..5b5b5607da69e 100644
--- a/clang/lib/Driver/ToolChains/PS4CPU.cpp
+++ b/clang/lib/Driver/ToolChains/PS4CPU.cpp
@@ -488,6 +488,9 @@ toolchains::PS4PS5Base::PS4PS5Base(const Driver &D, const llvm::Triple &Triple,
// control of header or library search. If we're not linking, don't check
// for missing libraries.
auto CheckSDKPartExists = [&](StringRef Dir, StringRef Desc) {
+ // In ThinLTO code generation mode SDK files are not required.
+ if (Args.hasArgNoClaim(options::OPT_fthinlto_index_EQ))
+ return true;
if (llvm::sys::fs::exists(Dir))
return true;
D.Diag(clang::diag::warn_drv_unable_to_find_directory_expected)
diff --git a/clang/test/Driver/ps4-sdk-root.c b/clang/test/Driver/ps4-sdk-root.c
index 6e5f1e28958ad..7c568a6680f25 100644
--- a/clang/test/Driver/ps4-sdk-root.c
+++ b/clang/test/Driver/ps4-sdk-root.c
@@ -11,6 +11,9 @@
///
/// The default <SDKROOT> for both headers and libraries is taken from the
/// SCE_ORBIS_SDK_DIR environment variable.
+///
+/// In ThinLTO code generation mode (-fthinlto-index=) SDK files are not required
+/// so all warnings are suppressed.
// RUN: echo "-### -Winvalid-or-nonexistent-directory -target x86_64-scei-ps4" > %t.rsp
@@ -31,6 +34,11 @@
/// headers and libraries.
// RUN: env SCE_ORBIS_SDK_DIR=.. %clang @%t.rsp %s 2>&1 | FileCheck -check-prefixes=WARN-SYS-HEADERS,WARN-SYS-LIBS,NO-WARN %s
+/// -fthinlto-index= warning suppression.
+// RUN: %clang -O2 %s -flto=thin -c -o %t.o
+// RUN: llvm-lto -thinlto -o %t %t.o
+// RUN: env SCE_ORBIS_SDK_DIR=.. %clang @%t.rsp %t.o -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck -check-prefixes=NO-WARN %s
+
/// If `-c`, `-S`, `-E` or `-emit-ast` is supplied, the existence check for SDK
/// libraries is skipped because no linking will be performed. We only expect
/// warnings about missing headers.
diff --git a/clang/test/Driver/ps5-sdk-root.c b/clang/test/Driver/ps5-sdk-root.c
index 16ef2cc01f5e7..558601d3a2082 100644
--- a/clang/test/Driver/ps5-sdk-root.c
+++ b/clang/test/Driver/ps5-sdk-root.c
@@ -13,6 +13,9 @@
///
/// The default <SDKROOT> for both headers and libraries is taken from the
/// SCE_PROSPERO_SDK_DIR environment variable.
+///
+/// In ThinLTO code generation mode (-fthinlto-index=) SDK files are not required
+/// so all warnings are suppressed.
// RUN: echo "-### -Winvalid-or-nonexistent-directory -target x86_64-sie-ps5" > %t.rsp
@@ -33,6 +36,11 @@
/// headers and libraries.
// RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s 2>&1 | FileCheck -check-prefixes=WARN-SYS-HEADERS,WARN-SYS-LIBS,NO-WARN %s
+/// -fthinlto-index= warning suppression.
+// RUN: %clang -O2 %s -flto=thin -c -o %t.o
+// RUN: llvm-lto -thinlto -o %t %t.o
+// RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %t.o -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck -check-prefixes=NO-WARN %s
+
/// If `-c`, `-S`, `-E` or `-emit-ast` is supplied, the existence check for SDK
/// libraries is skipped because no linking will be performed. We only expect
/// warnings about missing headers.
|
clang/test/Driver/ps5-sdk-root.c
Outdated
| /// -fthinlto-index= warning suppression. | ||
| // RUN: %clang -O2 %s -flto=thin -c -o %t.o | ||
| // RUN: llvm-lto -thinlto -o %t %t.o | ||
| // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %t.o -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck -check-prefixes=NO-WARN %s |
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.
Is it realistic to have -fthinlto-index without also -c?
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.
It seems unlikely. I don't know what the use-case would be for that.
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.
Should we add the -c to make this more realistic?
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.
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.
Thanks. Apologies for not expanding on the reasoning behind my query: since this change is motivated by the use of PS clang for remote codegen in a DTLTO context, it would seem sensible to ensure that situation is covered by the testing.
Our driver warns under various circumstances if SDK directories can't be found. This warning is not applicable in ThinLTO codegen mode (-fthinlto-index=). Suppress it. The motivation for doing this is that we sometimes see this warning emitted when DTLTO invokes the compiler on a remote machine to do the LTO backend compilations (with -fthinlto-index=). Internal Ref: TOOLCHAIN-20592
Our driver warns under various circumstances if SDK directories can't be found.
This warning is not applicable in ThinLTO codegen mode (-fthinlto-index=). Suppress it.
The motivation for doing this is that we sometimes see this warning emitted when DTLTO invokes the compiler on a remote machine to do the LTO backend compilations (with -fthinlto-index=).
Internal Ref: TOOLCHAIN-20592