[llvm] [SPIR-V] Preserve pointer-to-pointer element type for T*& parameters (PR #203113)

Nick Sarnie via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 07:50:41 PDT 2026


================
@@ -2144,6 +2171,15 @@ void SPIRVEmitIntrinsics::replacePointerOperandWithPtrCast(
     }
   }
 
+  // Never replace an already-deduced pointer pointee with a non-pointer one.
+  // The conflicting use comes from a mis-deduced expected type. Leave the
+  // operand untouched rather than emitting a ptrcast that re-introduces
+  // the collapsed type at the use site.
+  if (PointerElemTy && isPointerTyOrWrapper(PointerElemTy) &&
----------------
sarnex wrote:

Just for my own understanding can you give an example of what the non-pointer type would be? Would it be the deduced element type of the pointer?

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


More information about the llvm-commits mailing list