Skip to content
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

[SYCL][Driver] Fix suggested target triple in the warning message #4475

Merged
merged 1 commit into from
Sep 7, 2021
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
11 changes: 10 additions & 1 deletion clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,8 +925,17 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,

// Warn about deprecated `sycldevice` environment component.
if (TT.getEnvironmentName() == "sycldevice") {
// Build a string with suggested target triple.
std::string SuggestedTriple = TT.getArchName().str();
if (TT.getOS() != llvm::Triple::UnknownOS) {
SuggestedTriple += '-';
if (TT.getVendor() != llvm::Triple::UnknownVendor)
SuggestedTriple += TT.getVendorName();
SuggestedTriple += Twine("-" + TT.getOSName()).str();
} else if (TT.getVendor() != llvm::Triple::UnknownVendor)
SuggestedTriple += Twine("-" + TT.getVendorName()).str();
bader marked this conversation as resolved.
Show resolved Hide resolved
Diag(clang::diag::warn_drv_deprecated_arg)
<< TT.str() << TT.getArchName();
<< TT.str() << SuggestedTriple;
// Drop environment component.
std::string EffectiveTriple =
Twine(TT.getArchName() + "-" + TT.getVendorName() + "-" +
Expand Down
3 changes: 2 additions & 1 deletion clang/test/Driver/sycl.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
// DISABLED-NOT: "-sycl-std={{.*}}"
// DISABLED-NOT: "-fsycl-std-layout-kernel-params"

// RUN: %clangxx -fsycl -fsycl-targets=spir64-unknown-unknown-sycldevice -c %s 2>&1 | FileCheck %s --check-prefix=CHECK_WARNING
// RUN: %clangxx -fsycl -fsycl-targets=spir64-unknown-unknown-sycldevice,nvptx64-nvidia-cuda-sycldevice -fno-sycl-libspirv -nocudalib -c %s 2>&1 | FileCheck %s --check-prefix=CHECK_WARNING
// CHECK_WARNING: argument 'spir64-unknown-unknown-sycldevice' is deprecated, use 'spir64' instead
// CHECK_WARNING: argument 'nvptx64-nvidia-cuda-sycldevice' is deprecated, use 'nvptx64-nvidia-cuda' instead

// RUN: %clang -### -fsycl-device-only -c %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
// RUN: %clang -### -fsycl-device-only %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
Expand Down