Skip to content

Commit c8279c1

Browse files
committed
Fix 32-bit long size check
Originally I changed the isOsWindows check to isWindowsMSVCEnvironment, but neither of those is correct. The correct check is isOsWindows && !isWindowsCygwinEnvironment, because all known Windows environments except Cygwin use 32-bit long. I think we don't support SYCL on MinGW or Cygwin, but this is one less bug to fix if we ever decide to.
1 parent 3bd2767 commit c8279c1

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,12 @@ SYCLInstallationDetector::SYCLInstallationDetector(
152152
static llvm::SmallString<64>
153153
getLibSpirvBasename(const llvm::Triple &DeviceTriple,
154154
const llvm::Triple &HostTriple) {
155-
// Select remangled libclc variant
156-
llvm::SmallString<64> Result(HostTriple.isWindowsMSVCEnvironment()
155+
// Select remangled libclc variant.
156+
// Decide long size based on host triple, because offloading targets are going
157+
// to match that.
158+
// All known windows environments except Cygwin use 32-bit long.
159+
llvm::SmallString<64> Result(HostTriple.isOSWindows() &&
160+
!HostTriple.isWindowsCygwinEnvironment()
157161
? "remangled-l32-signed_char.libspirv-"
158162
: "remangled-l64-signed_char.libspirv-");
159163

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55

66
// RUN: %clang -### -fsycl -fsycl-targets=nvptx64-nvidia-cuda -nocudalib -target x86_64-unknown-windows-msvc %s 2>&1 \
77
// RUN: | FileCheck %s --check-prefixes=CHECK-WINDOWS
8+
// RUN: %clang -### -fsycl -fsycl-targets=nvptx64-nvidia-cuda -nocudalib -target x86_64-unknown-windows-gnu %s 2>&1 \
9+
// RUN: | FileCheck %s --check-prefixes=CHECK-WINDOWS
810
// CHECK-WINDOWS: "-cc1"{{.*}} "-fsycl-is-device"{{.*}} "-mlink-builtin-bitcode" "{{.*[\\/]}}remangled-l32-signed_char.libspirv-nvptx64-nvidia-cuda.bc"
911
//
1012
// RUN: %clang -### -fsycl -fsycl-targets=nvptx64-nvidia-cuda -nocudalib -target x86_64-unknown-linux-gnu %s 2>&1 \
1113
// RUN: | FileCheck %s --check-prefixes=CHECK-LINUX
14+
// RUN: %clang -### -fsycl -fsycl-targets=nvptx64-nvidia-cuda -nocudalib -target x86_64-unknown-windows-cygnus %s 2>&1 \
15+
// RUN: | FileCheck %s --check-prefixes=CHECK-LINUX
1216
// CHECK-LINUX: "-cc1"{{.*}} "-fsycl-is-device"{{.*}} "-mlink-builtin-bitcode" "{{.*[\\/]}}remangled-l64-signed_char.libspirv-nvptx64-nvidia-cuda.bc"
1317
//
1418
// RUN: %clang -### -resource-dir %{resource_dir} -fsycl -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx908 -nogpulib -target x86_64-unknown-windows-msvc %s 2>&1 \

0 commit comments

Comments
 (0)