[clang] [llvm] [clang] Check validity of SYCL device target (PR #172366)

via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 30 11:54:44 PDT 2026


================
@@ -0,0 +1,16 @@
+/// Check "-fsycl-is-device" and the default triple "spirv64-unknown-unknown"
+//  is passed when compiling for device.
+
+// RUN:   %clang -### -fsycl -fsycl-device-only %s 2>&1 \
+// RUN:   | FileCheck %s
+
+// CHECK: "-triple" "spirv64-unknown-unknown" {{.*}} "-fsycl-is-device"
+
+/// Check "-fsycl-is-device" and explicitly specified triple "nvptx" is
+//  passed when compiling for device.
+
+// RUN:   %clang -### -fsycl -fsycl-device-only --target=nvptx %s 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=TARGET
+//
+// TARGET: "-triple" "spirv32-unknown-unknown" "-aux-triple" "nvptx"
----------------
elizabethandrews wrote:

Just to clarify, I do agree we need to figure out what is happening with `--target` and how it controls the toolchain better. There seems to be a bunch of different options related to offload targets (both in Clang and downstream in intel/llvm) and it is unclear to me what the required functionality of each is.  I would prefer handling it as a separate PR or task though since this PR was just to fix the `cc1` crash 

https://github.com/llvm/llvm-project/pull/172366


More information about the cfe-commits mailing list