================
@@ -272,8 +286,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) {
+      SizeType = TargetInfo::UnsignedInt;
+      PtrDiffType = IntPtrType = TargetInfo::SignedInt;
+    }
----------------
tahonermann wrote:

If we do what I suggested in another comment and assign `PointerWidth` and 
`PointerAlign` in `BaseSPIRTargetInfo` when a host target is present, then we 
can add asserts here that expectations are met. Likewise for the SPIR64, 
SPIR-V32, and SPIR-V64 targets.

```suggestion
    if (!HostTarget) {
      PointerWidth = PointerAlign = 32;
      SizeType = TargetInfo::UnsignedInt;
      PtrDiffType = IntPtrType = TargetInfo::SignedInt;
    } else {
      assert(PointerWidth == 32 && "Invalid host target pointer size for 
SPIR32");
      assert(PointerAlign == 32 && "Invalid host target pointer alignment for 
SPIR32");
    }
```

https://github.com/llvm/llvm-project/pull/208196
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to