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

Dmitry Sidorov via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 5 08:10:23 PDT 2026


================
@@ -2848,8 +2906,11 @@ bool SPIRVInstructionSelector::selectAddrSpaceCast(Register ResVReg,
   SPIRVTypeInst SrcPtrTy = GR.getSPIRVTypeForVReg(SrcPtr);
 
   // don't generate a cast for a null that may be represented by OpTypeInt
-  if (SrcPtrTy->getOpcode() != SPIRV::OpTypePointer ||
-      ResType->getOpcode() != SPIRV::OpTypePointer)
+  auto IsPtrTy = [](SPIRVTypeInst T) {
+    return T && (T->getOpcode() == SPIRV::OpTypePointer ||
----------------
MrSidims wrote:

Should be addressed almost everywhere now.
I kept
```
bool SPIRVTypeInst::isTypePtr() const {
  return MI->getOpcode() == SPIRV::OpTypePointer;
}
```
let me do this renaming in a separate PR as I'm actually not sure, what naming here is better.

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


More information about the cfe-commits mailing list