[llvm] [SPIR-V] Fix validation errors for function pointers with CodeSectionINTEL storage class (PR #192973)

Arseniy Obolenskiy via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 28 08:05:43 PDT 2026


================
@@ -373,10 +380,20 @@ static SPIRVTypeInst propagateSPIRVType(MachineInstr *MI,
             RegType.isPointer() &&
             storageClassToAddressSpace(GR->getPointerStorageClass(SpvType)) !=
                 RegType.getAddressSpace()) {
-          const SPIRVSubtarget &ST =
-              MI->getParent()->getParent()->getSubtarget<SPIRVSubtarget>();
-          auto TSC = addressSpaceToStorageClass(RegType.getAddressSpace(), ST);
-          SpvType = GR->changePointerStorageClass(SpvType, TSC, *MI);
+          // Don't correct CodeSectionINTEL back to Function for function
+          // pointer G_GLOBAL_VALUE - the LLVM register has address space 0
+          // but the SPIR-V type was intentionally set to CodeSectionINTEL.
+          bool SkipCorrection =
----------------
aobolensk wrote:

I can see that, for `addrspace(9)` it is unneeded, but in general it is still relevant

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


More information about the llvm-commits mailing list