[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:06:57 PDT 2026


================
@@ -4926,16 +4928,22 @@ bool SPIRVInstructionSelector::wrapIntoSpecConstantOp(
       CompositeArgs.push_back(WrapReg);
       continue;
     }
-    // Create a new register for the wrapper
-    WrapReg = MRI->createVirtualRegister(GR.getRegClass(OpType));
+    SPIRVTypeInst WrapType = OpType;
+    if (OpType->getOpcode() == SPIRV::OpTypePointer &&
+        GR.getPointerStorageClass(OpType) ==
+            SPIRV::StorageClass::CodeSectionINTEL) {
+      WrapType = GR.changePointerStorageClass(OpType,
----------------
aobolensk wrote:

global-var-intrinsic.ll and pointers/fun-with-aggregate-arg-in-const-init.ll are failing in case I revert this piece of code

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


More information about the llvm-commits mailing list