[clang] [SYCL][SPIR-V] Implement fix for Windows/MSVC SPIR-V device target support (PR #208196)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 10 15:55:37 PDT 2026


================
@@ -164,6 +164,18 @@ class LLVM_LIBRARY_VISIBILITY BaseSPIRTargetInfo : public TargetInfo {
       UseExplicitBitFieldAlignment = HostTarget->useExplicitBitFieldAlignment();
       ZeroLengthBitfieldBoundary = HostTarget->getZeroLengthBitfieldBoundary();
 
+      // Copy pointer-related type representations from host so that
+      // sizeof(size_t), sizeof(ptrdiff_t), sizeof(intptr_t) match
+      // between host and device. Without this, LLP64 hosts (Windows)
+      // get incorrect LP64-style defaults.
+      SizeType = HostTarget->getSizeType();
+      PtrDiffType = HostTarget->getPtrDiffType(LangAS::Default);
+      IntPtrType = HostTarget->getIntPtrType();
+
+      // Inherit Microsoft C mangling if the host uses it.
+      if (HostTarget->shouldUseMicrosoftCCforMangling())
+        UseMicrosoftManglingForC = true;
----------------
tahonermann wrote:

I suggest we skip the Microsoft mangling related change for now since there are currently no uses of it with the SPIR and SPIR-V targets. If/when we update the Microsoft mangler to support SPIR/SPIR-V builtin types and generally enable its use for device targets, we can add this back. In the meantime, I think adding this now just invites controversy.

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


More information about the cfe-commits mailing list