[clang] [llvm] [SPIR-V] Implement SPV_KHR_untyped_pointers extension (PR #201233)

Dmitry Sidorov via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 4 08:55:25 PDT 2026


================
@@ -621,13 +621,17 @@ bool SPIRVTargetLowering::enforcePtrTypeCompatibility(
     MachineInstr &I, unsigned int PtrOpIdx, unsigned int OpIdx) const {
   SPIRVGlobalRegistry &GR = *STI.getSPIRVGlobalRegistry();
   SPIRVTypeInst PtrType = GR.getResultType(I.getOperand(PtrOpIdx).getReg());
+
+  if (PtrType && PtrType->getOpcode() == SPIRV::OpTypeUntypedPointerKHR)
+    return true;
+
   SPIRVTypeInst PointeeType = GR.getPointeeType(PtrType);
   SPIRVTypeInst OpType = GR.getResultType(I.getOperand(OpIdx).getReg());
 
   if (PointeeType == OpType)
     return true;
 
-  if (typesLogicallyMatch(PointeeType, OpType, GR)) {
+  if (PointeeType && OpType && typesLogicallyMatch(PointeeType, OpType, GR)) {
----------------
MrSidims wrote:

added comment

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


More information about the llvm-commits mailing list