[clang] [SYCL][SPIR-V][Windows] Extend BaseSPIRTargetInfo host-adaptation for Windows support (PR #208196)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 20 22:13:10 PDT 2026


================
@@ -272,8 +284,10 @@ class LLVM_LIBRARY_VISIBILITY SPIR32TargetInfo : public SPIRTargetInfo {
     assert(Triple.getArch() == llvm::Triple::spir &&
            "Invalid architecture for 32-bit SPIR.");
     PointerWidth = PointerAlign = 32;
-    SizeType = TargetInfo::UnsignedInt;
-    PtrDiffType = IntPtrType = TargetInfo::SignedInt;
+    if (!HostTarget || HostTarget->getPointerWidth(LangAS::Default) != 32) {
+      SizeType = TargetInfo::UnsignedInt;
+      PtrDiffType = IntPtrType = TargetInfo::SignedInt;
+    }
----------------
schittir wrote:

Thanks for the suggestion! I gave it a try, but reverted it — dropping the || HostTarget->getPointerWidth(...) != 32 clause breaks two existing tests in CI (the 32-bit-SPIR-device / 64-bit-host combination we discussed above):

  https://github.com/llvm/llvm-project/actions/runs/29756545672/attempts/1#summary-88400317949
  1. clang/test/Frontend/sycl-aux-triple.cpp — -fsycl-is-device -triple spir -aux-triple x86_64-unknown-linux-gnu
  2. clang/test/CodeGenSYCL/kernel-caller-entry-point.cpp — -fsycl-is-device -aux-triple x86_64-pc-windows-msvc -triple  spir-unknown-unknown (also x86_64-uefi, spirv32)

Two options - which would you prefer? 1. Drop those RUN lines in the tests now (i.e., disallow that combination of host and device), or 2. handle it in a follow-up PR, since treating this as like an error feels like a separate change (potentially combined with other SPIR-related removals). 
Sorry if this feels like nitpicking - I'd rather make this call intentionally (and uniformly across other combinations too). 

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


More information about the cfe-commits mailing list