Skip to content

Commit d0631bd

Browse files
committed
remove OPT__HASH_HASH_HASH check
1 parent 29fa994 commit d0631bd

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ const char *SYCLInstallationDetector::findLibspirvPath(
6464
const SmallString<64> Basename =
6565
getLibSpirvBasename(DeviceTriple, HostTriple);
6666
auto searchAt = [&](StringRef Path, const Twine &a = "", const Twine &b = "",
67-
bool HashHashHashEnabled = false) -> const char * {
67+
const Twine &c = "") -> const char * {
6868
SmallString<128> LibraryPath(Path);
69-
llvm::sys::path::append(LibraryPath, a, b, "", Basename);
69+
llvm::sys::path::append(LibraryPath, a, b, c, Basename);
7070

71-
if (HashHashHashEnabled || llvm::sys::fs::exists(LibraryPath))
71+
if (llvm::sys::fs::exists(LibraryPath))
7272
return Args.MakeArgString(LibraryPath);
7373

7474
return nullptr;
@@ -80,9 +80,7 @@ const char *SYCLInstallationDetector::findLibspirvPath(
8080
return R;
8181

8282
// Expected path w/ install.
83-
bool HashHashHashEnabled = (&IC == &InstallationCandidates.back()) &&
84-
Args.hasArgNoClaim(options::OPT__HASH_HASH_HASH);
85-
if (const char *R = searchAt(IC, "share", "clc", HashHashHashEnabled))
83+
if (const char *R = searchAt(IC, "share", "clc"))
8684
return R;
8785
}
8886

clang/test/Driver/sycl-libspirv-toolchain.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,25 @@
2929
// CHECK-CUDA: "-cc1"{{.*}} "-fcuda-is-device"
3030
// CHECK-CUDA-NOT: "-mlink-builtin-bitcode" "{{.*}}.libspirv-{{.*}}.bc"
3131
//
32-
// The path to the remangled libspirv bitcode file is determined by the installation directory and `/share/clc/` is part of the path.
32+
// The path to the remangled libspirv bitcode file is determined by the installation directory
3333
// RUN: %clang -### -ccc-install-dir %{install_dir} -resource-dir %{resource_dir} -fsycl -fsycl-targets=nvptx64-nvidia-cuda -nocudalib %s 2>&1 \
34-
// RUN: | FileCheck %s -DINSTALL_DIR=%{install_dir} --check-prefixes=CHECK-DIR
35-
// CHECK-DIR: "-cc1"{{.*}} "-fsycl-is-device"{{.*}} "-mlink-builtin-bitcode" "[[INSTALL_DIR]]{{.*[\\/]}}share{{.*}}clc{{.*}}remangled-{{.*}}.libspirv-nvptx64-nvidia-cuda.bc"
34+
// RUN: | FileCheck %s -DINSTALL_DIR=%{install_dir} -DRESOURCE_DIR=%{resource_dir} --check-prefixes=CHECK-DIR
35+
// CHECK-DIR: "-cc1"{{.*}} "-fsycl-is-device"{{.*}} "-mlink-builtin-bitcode" "[[INSTALL_DIR]]{{.*[\\/]}}remangled-{{.*}}.libspirv-nvptx64-nvidia-cuda.bc"
3636
//
37-
// The `-###` option disables file existence checks
37+
// If libspirv path doesn't exist, error is reported.
3838
// DEFINE: %{nonexistent_dir} = %/S/Inputs/SYCL/does_not_exist/lib/clang/resource_dir
39-
// RUN: %clang -### -ccc-install-dir %{nonexistent_dir} -fsycl -fsycl-targets=nvptx64-nvidia-cuda -nocudalib %s 2>&1 \
39+
// RUN: not %clang -### -ccc-install-dir %{nonexistent_dir} -fsycl -fsycl-targets=nvptx64-nvidia-cuda -nocudalib %s 2>&1 \
4040
// RUN: | FileCheck %s -DDIR=%{nonexistent_dir} --check-prefixes=CHECK-HHH-NONEXISTENT
41-
// CHECK-HHH-NONEXISTENT: "-cc1"{{.*}} "-fsycl-is-device"{{.*}} "-mlink-builtin-bitcode" "[[DIR]]{{.*[\\/]}}remangled-{{.*}}.libspirv-nvptx64-nvidia-cuda.bc"
41+
// CHECK-HHH-NONEXISTENT: clang: error: cannot find 'remangled-l64-signed_char.libspirv-nvptx64-nvidia-cuda.bc'; provide path to libspirv library via '-fsycl-libspirv-path', or pass '-fno-sycl-libspirv' to build without linking with libspirv
4242
//
43-
// RUN: %clang -### -ccc-install-dir %{nonexistent_dir} -fsycl -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx908 -nogpulib %s 2>&1 \
43+
// RUN: %clang -### -ccc-install-dir %{nonexistent_dir} -fsycl -fsycl-targets=nvptx64-nvidia-cuda -nocudalib -fno-sycl-libspirv %s 2>&1 \
44+
// RUN: | FileCheck %s -DDIR=%{nonexistent_dir} --check-prefixes=CHECK-HHH-NONEXISTENT-NOSYCLLIBSPIRV
45+
// CHECK-HHH-NONEXISTENT-NOSYCLLIBSPIRV: clang: warning: '-fno-sycl-libspirv' should not be used with target 'nvptx64-nvidia-cuda'; libspirv is required for correct behavior [-Wunsafe-libspirv-not-linked]
46+
//
47+
// RUN: not %clang -### -ccc-install-dir %{nonexistent_dir} -fsycl -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx908 -nogpulib %s 2>&1 \
4448
// RUN: | FileCheck %s -DDIR=%{nonexistent_dir} --check-prefixes=CHECK-AMDGCN-HHH-NONEXISTENT
45-
// CHECK-AMDGCN-HHH-NONEXISTENT: "-cc1"{{.*}} "-fsycl-is-device"{{.*}} "-mlink-builtin-bitcode" "[[DIR]]{{.*[\\/]}}remangled-{{.*}}.libspirv-amdgcn-amd-amdhsa.bc"
49+
// CHECK-AMDGCN-HHH-NONEXISTENT: clang: error: cannot find 'remangled-l64-signed_char.libspirv-amdgcn-amd-amdhsa.bc'; provide path to libspirv library via '-fsycl-libspirv-path', or pass '-fno-sycl-libspirv' to build without linking with libspirv
4650
//
47-
// `-fdriver-only` has no such special handling, so it will not find the file
4851
// RUN: not %clang -fdriver-only -ccc-install-dir %{nonexistent_dir} -fsycl -fsycl-targets=nvptx64-nvidia-cuda -nocudalib %s 2>&1 \
4952
// RUN: | FileCheck %s -DDIR=%{nonexistent_dir} --check-prefixes=CHECK-DO-NONEXISTENT
5053
// CHECK-DO-NONEXISTENT: error: cannot find 'remangled-{{.*}}.libspirv-nvptx64-nvidia-cuda.bc'; provide path to libspirv library via '-fsycl-libspirv-path', or pass '-fno-sycl-libspirv' to build without linking with libspirv

0 commit comments

Comments
 (0)