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

Dmitry Sidorov via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 21 04:23:44 PDT 2026


================
@@ -16,7 +13,7 @@
 ; CHECK-DAG: %[[#Null:]] = OpConstantNull %[[#Int8PtrTy]]
 ; CHECK-DAG: %[[#FnPtr:]] = OpConstantFunctionPointerINTEL %[[#CodePtrTy]] %[[#FnDef:]]
 ; CHECK:     %[[#FnDef]] = OpFunction %[[#Void]] None %[[#FnTy]]
-; CHECK:     %[[#Cast:]] = OpPtrCastToGeneric %[[#GenPtrTy]] %[[#FnPtr]]
+; CHECK:     %[[#Cast:]] = OpBitcast %[[#GenPtrTy]] %[[#FnPtr]]
----------------
MrSidims wrote:

This is neither a valid SPIR-V, from [OpBitcast](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpBitcast) description: "If both Result Type and the type of Operand are pointers, they both must point into same [storage class](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#Storage_Class)."

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


More information about the llvm-commits mailing list