[llvm] [SPIR-V] Fix illegal pointer types for functions used as plain values (PR #208250)
Dmitry Sidorov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 9 07:50:44 PDT 2026
================
@@ -0,0 +1,42 @@
+; Without SPV_INTEL_function_pointers, a Function referenced as a plain value
+; (not a call target) must not leak its own FunctionType or address-space
+; attribute into a pointer type. Two symptoms of the same root cause, kept as
+; separate modules so each regresses on its own (a single module lets one
+; case's incidental OpUndef mask the other's).
+
+; RUN: split-file %s %t
+
+; The reference lowers to a placeholder that must be OpTypePointer Function
+; %uchar, not a pointer built from the function's own type or its
+; address-space attribute.
+; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %t/undef-placeholder.ll -o - | FileCheck %s --check-prefix=UNDEF
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %t/undef-placeholder.ll -o - -filetype=obj | spirv-val %}
+
+; UNDEF-DAG: %[[#UCHAR:]] = OpTypeInt 8 0
+; UNDEF-DAG: %[[#PTR:]] = OpTypePointer Function %[[#UCHAR]]
+; UNDEF: OpUndef %[[#PTR]]
----------------
MrSidims wrote:
Shouldn't we rather abort the lowering rather than generating **OpUndef**? If we really wanted to translate a function pointer without the extension, so what have we expected?
https://github.com/llvm/llvm-project/pull/208250
More information about the llvm-commits
mailing list