Skip to content

Commit 8b09e59

Browse files
authored
[SYCL][Driver] Respect -nocudalib again after bad merge conflict resolution (#19216)
[fc26ef4][1] is a bad resolution `--offloadlib` is a positive option to explicitly link offload device libraries (usually on by default), while the option it replaced (`-nogpulib`) was the negative option to disable linking them. To behave correctly, we need to consider both positive and negative options. The test did not catch this because the filecheck CHECK-NOT directive had a typo. Fix that as well. [1]: fc26ef4#diff-f8c64e36dfe3828a6f816c4550e78bb0305769ace1be53207e86ac9a3280ac9eR6291
1 parent 27f4252 commit 8b09e59

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5993,7 +5993,9 @@ class OffloadingActionBuilder final {
59935993
}
59945994

59955995
// For NVPTX we also need to link with the CUDA libdevice
5996-
if (TC->getTriple().isNVPTX() && !Args.hasArg(options::OPT_offloadlib)) {
5996+
if (TC->getTriple().isNVPTX() &&
5997+
Args.hasFlag(options::OPT_offloadlib, options::OPT_no_offloadlib,
5998+
true)) {
59975999
const toolchains::CudaToolChain *CudaTC =
59986000
static_cast<const toolchains::CudaToolChain *>(TC);
59996001
std::string LibDeviceFile =

clang/test/Driver/sycl-nvptx-link.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@
4545
// LIBDEVICE30-SAME: libdevice.compute_30.10.bc
4646
// LIBDEVICE35-SAME: libdevice.compute_35.10.bc
4747
// LIBDEVICE50-SAME: libdevice.compute_50.10.bc
48-
// NOLIBDEVICE-NOT: libdevice.{{.*}}.10.bc
48+
// NOLIBDEVICE-NOT: libdevice{{.*}}.10.bc

0 commit comments

Comments
 (0)