[clang] [llvm] [Clang][SYCL] Define Intel IGCA preprocessor macro definitions for SYCL during device compilation (PR #227877)

Ian Li via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 5 11:57:16 PST 2026


================
@@ -313,6 +314,12 @@ class LLVM_LIBRARY_VISIBILITY BaseSPIRVTargetInfo : public BaseSPIRTargetInfo {
     return Feature == "spirv";
   }
 
+  // The LLVM SPIR-V backend defines no processors and accepts only "generic";
+  // The -target-cpu value used in BaseSPIRTargetInfo is only used by the
+  // frontend, and the backend / createTargetMachine should not use this
+  // -target-cpu value to (attempt to) construct an LLVM TargetMachine.
+  StringRef getBackendCPU() const override { return StringRef(); }
----------------
ianayl wrote:

It turns out `-target-cpu` values are also used to create the `TargetMachine` used to emit LLVM/assembly; Since the [LLVM SPIRV target only accepts a `generic` CPU currently](https://github.com/ianayl/llvm-project/blob/sycl/IGCA/arch-preprocessor-defs/llvm/lib/Target/SPIRV/SPIRV.td#L24), I opted to make `-target-cpu` not reach `createTargetMachine` instead, but please let me know if this is the wrong move here.

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


More information about the cfe-commits mailing list