Skip to content

Commit b437fa4

Browse files
authored
[SYCL][Driver] Fix windows build warning (#16237)
Move addSingleLibrary etc into WIN32 guard, avoid unused function warnings in windows build.
1 parent 3ac3e1b commit b437fa4

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,29 @@ SYCL::getDeviceLibraries(const Compilation &C, const llvm::Triple &TargetTriple,
576576
}
577577
};
578578

579+
addLibraries(SYCLDeviceWrapperLibs);
580+
if (IsSpirvAOT)
581+
addLibraries(SYCLDeviceFallbackLibs);
582+
583+
bool NativeBfloatLibs;
584+
bool NeedBfloatLibs = selectBfloatLibs(TargetTriple, C, NativeBfloatLibs);
585+
if (NeedBfloatLibs) {
586+
// Add native or fallback bfloat16 library.
587+
if (NativeBfloatLibs)
588+
addLibraries(SYCLDeviceBfloat16NativeLib);
589+
else
590+
addLibraries(SYCLDeviceBfloat16FallbackLib);
591+
}
592+
593+
// Link in ITT annotations library unless fsycl-no-instrument-device-code
594+
// is specified. This ensures that we are ABI-compatible with the
595+
// instrumented device code, which was the default not so long ago.
596+
if (Args.hasFlag(options::OPT_fsycl_instrument_device_code,
597+
options::OPT_fno_sycl_instrument_device_code, true))
598+
addLibraries(SYCLDeviceAnnotationLibs);
599+
600+
#if !defined(_WIN32)
601+
579602
auto addSingleLibrary = [&](const DeviceLibOptInfo &Lib) {
580603
if (!DeviceLibLinkInfo[Lib.DeviceLibOption])
581604
return;
@@ -636,28 +659,6 @@ SYCL::getDeviceLibraries(const Compilation &C, const llvm::Triple &TargetTriple,
636659
return JIT;
637660
};
638661

639-
addLibraries(SYCLDeviceWrapperLibs);
640-
if (IsSpirvAOT)
641-
addLibraries(SYCLDeviceFallbackLibs);
642-
643-
bool NativeBfloatLibs;
644-
bool NeedBfloatLibs = selectBfloatLibs(TargetTriple, C, NativeBfloatLibs);
645-
if (NeedBfloatLibs) {
646-
// Add native or fallback bfloat16 library.
647-
if (NativeBfloatLibs)
648-
addLibraries(SYCLDeviceBfloat16NativeLib);
649-
else
650-
addLibraries(SYCLDeviceBfloat16FallbackLib);
651-
}
652-
653-
// Link in ITT annotations library unless fsycl-no-instrument-device-code
654-
// is specified. This ensures that we are ABI-compatible with the
655-
// instrumented device code, which was the default not so long ago.
656-
if (Args.hasFlag(options::OPT_fsycl_instrument_device_code,
657-
options::OPT_fno_sycl_instrument_device_code, true))
658-
addLibraries(SYCLDeviceAnnotationLibs);
659-
660-
#if !defined(_WIN32)
661662
std::string SanitizeVal;
662663
size_t sanitizer_lib_idx = getSingleBuildTarget();
663664
if (Arg *A = Args.getLastArg(options::OPT_fsanitize_EQ,

0 commit comments

Comments
 (0)