[clang] [Clang][Driver] Enable offloadlib option for clang-cl (PR #162980)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 20 19:23:51 PDT 2025
https://github.com/jinge90 updated https://github.com/llvm/llvm-project/pull/162980
>From c6bc633dfcb7ef64e6454bcebe83df2c075b50e3 Mon Sep 17 00:00:00 2001
From: jinge90 <ge.jin at intel.com>
Date: Sat, 11 Oct 2025 14:51:38 +0800
Subject: [PATCH 1/3] Enable offloadlib option in compilation for SYCL
Signed-off-by: jinge90 <ge.jin at intel.com>
---
clang/include/clang/Driver/Options.td | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index ec38231f906eb..4479aadf6949b 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5970,10 +5970,10 @@ def : Flag<["-"], "nocudainc">, Alias<no_offload_inc>;
def no_offloadlib
: Flag<["--"], "no-offloadlib">,
MarshallingInfoFlag<LangOpts<"NoGPULib">>,
- Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
- HelpText<"Do not link device library for CUDA/HIP device compilation">;
+ Visibility<[ClangOption, CC1Option, CLOption, FlangOption, FC1Option]>,
+ HelpText<"Do not link device library for CUDA/HIP/SYCL device compilation">;
def offloadlib : Flag<["--"], "offloadlib">,
- Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
+ Visibility<[ClangOption, CC1Option, CLOption, FlangOption, FC1Option]>,
HelpText<"Link device libraries for GPU device compilation">;
def : Flag<["-"], "nogpulib">,
Alias<no_offloadlib>,
>From 8ae41610041c933076731243675456cf9ab32811 Mon Sep 17 00:00:00 2001
From: jinge90 <ge.jin at intel.com>
Date: Wed, 15 Oct 2025 15:36:44 +0800
Subject: [PATCH 2/3] add lit test for [no-]offloadlib in CL mode
Signed-off-by: jinge90 <ge.jin at intel.com>
---
clang/test/Driver/sycl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/clang/test/Driver/sycl.c b/clang/test/Driver/sycl.c
index 2a672ccf0692d..e08f95e6ae694 100644
--- a/clang/test/Driver/sycl.c
+++ b/clang/test/Driver/sycl.c
@@ -25,3 +25,6 @@
// RUN: %clang_cl -### -fsycl -- %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
// DEFAULT: "-sycl-std=2020"
+
+// RUN: %clang_cl -### -fsycl -sycl-std=2017 --no-offloadlib -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OFFLOADLIB
+// CHECK-NO-OFFLOADLIB-NOT: warning: unknown argument ignored in clang-cl: '--no-offloadlib'
>From da883fe0597e29e4d2dfffa34eb16a6a71b2230b Mon Sep 17 00:00:00 2001
From: jinge90 <ge.jin at intel.com>
Date: Tue, 21 Oct 2025 10:23:04 +0800
Subject: [PATCH 3/3] cover clang/clangxx driver in lit
Signed-off-by: jinge90 <ge.jin at intel.com>
---
clang/test/Driver/sycl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/clang/test/Driver/sycl.c b/clang/test/Driver/sycl.c
index e08f95e6ae694..5c210c8c181da 100644
--- a/clang/test/Driver/sycl.c
+++ b/clang/test/Driver/sycl.c
@@ -26,5 +26,7 @@
// DEFAULT: "-sycl-std=2020"
+// RUN: %clang -### -fsycl -sycl-std=2017 --no-offloadlib -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OFFLOADLIB
+// RUN: %clangxx -### -fsycl -sycl-std=2017 --no-offloadlib -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OFFLOADLIB
// RUN: %clang_cl -### -fsycl -sycl-std=2017 --no-offloadlib -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OFFLOADLIB
// CHECK-NO-OFFLOADLIB-NOT: warning: unknown argument ignored in clang-cl: '--no-offloadlib'
More information about the cfe-commits
mailing list