Skip to content

Commit 73bba79

Browse files
authored
[Driver][SYCL] Adjust debug format for SYCL device on Windows (#11684)
Setting debug information is determined by using -g, as opposed to earlier representation using -Zi specifically for Windows. The use of codeview is dependent on the target. When we know that the host target is MSVC based, use the host toolchain setting of the debug format as opposed to the default toolchain which defaults to dwarf.
1 parent adec324 commit 73bba79

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

clang/lib/Driver/ToolChains/SYCL.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ class LLVM_LIBRARY_VISIBILITY SYCLToolChain : public ToolChain {
194194
return false;
195195
}
196196
llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override {
197-
if (this->IsSYCLNativeCPU)
197+
if (this->IsSYCLNativeCPU ||
198+
this->HostTC.getTriple().isWindowsMSVCEnvironment())
198199
return this->HostTC.getDefaultDebugFormat();
199200
return ToolChain::getDefaultDebugFormat();
200201
}

clang/test/Driver/sycl.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,12 @@
154154
// RUN: %clang -fsycl -fsycl-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx908 -Xsycl-target-backend=nvptx64-nvidia-cuda --offload-arch=sm_86 -c -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=MULTIPLE_TARGETS
155155
// MULTIPLE_TARGETS: offload, "device-sycl (nvptx64-nvidia-cuda:sm_86)"
156156
// MULTIPLE_TARGETS: offload, "device-sycl (amdgcn-amd-amdhsa:gfx908)"
157+
158+
/// Verify debug format for spir target.
159+
// RUN: %clang -### -target x86_64-windows-msvc -fsycl -g -c %s 2>&1 \
160+
// RUN: | FileCheck -check-prefix=DEBUG-WIN %s
161+
// RUN: %clang_cl -### -fsycl -Zi -c %s 2>&1 \
162+
// RUN: | FileCheck -check-prefix=DEBUG-WIN %s
163+
// DEBUG-WIN: {{.*}}"-fsycl-is-device"{{.*}}"-gcodeview"
164+
// DEBUG-WIN: {{.*}}"-fsycl-is-host"{{.*}}"-gcodeview"
165+
// DEBUG-WIN-NOT: dwarf-version

0 commit comments

Comments
 (0)