[llvm] [SPIRV] Add support for pointers to functions with aggregate args/returns as global variables / constant initialisers (PR #169595)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 25 18:48:45 PST 2025


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 166362 tests passed
* 2873 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### LLVM
<details>
<summary>LLVM.CodeGen/SPIRV/pointers/fun-with-aggregate-arg-in-const-init.ll</summary>

```
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_INTEL_function_pointers /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/pointers/fun-with-aggregate-arg-in-const-init.ll -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/pointers/fun-with-aggregate-arg-in-const-init.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_INTEL_function_pointers /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/pointers/fun-with-aggregate-arg-in-const-init.ll -o -
# .---command stdout------------
# | 	OpCapability Kernel
# | 	OpCapability Addresses
# | 	OpCapability Float16
# | 	OpCapability FunctionPointersINTEL
# | 	OpCapability Int64
# | 	OpCapability Int8
# | 	OpCapability Linkage
# | 	OpExtension "SPV_INTEL_function_pointers"
# | 	%1 = OpExtInstImport "OpenCL.std"
# | 	OpMemoryModel Physical64 OpenCL
# | 	OpSource OpenCL_CPP 100000
# | 	OpName %60 "p"
# | 	OpName %61 "array"
# | 	OpName %44 "fnptr"
# | 	OpName %46 "fnstruct"
# | 	OpName %63 "f"
# | 	OpName %65 "g"
# | 	OpName %67 "h"
# | 	OpName %10 "t_half"
# | 	OpName %2 "entry"
# | 	OpName %72 "p"
# | 	OpName %73 "struct"
# | 	OpName %76 "f"
# | 	OpName %49 "struct.anon"
# | 	OpName %80 "g"
# | 	OpName %83 "h"
# | 	OpName %3 "entry"
# | 	OpName %29 "a"
# | 	OpName %30 "b"
# | 	OpName %28 "f0"
# | 	OpName %33 "a"
# | 	OpName %34 "b"
# | 	OpName %32 "f1"
# | 	OpName %37 "a"
# | 	OpName %38 "b"
# | 	OpName %36 "f2"
# | 	OpName %4 "entry"
# | 	OpDecorate %61 LinkageAttributes "array" Export
# | 	OpDecorate %44 Constant
# | 	OpDecorate %44 LinkageAttributes "fnptr" Export
# | 	OpDecorate %46 Constant
# | 	OpDecorate %46 Alignment 8
# | 	OpDecorate %46 LinkageAttributes "fnstruct" Export
# | 	OpDecorate %73 LinkageAttributes "struct" Export
# | 	OpDecorate %28 LinkageAttributes "f0" Import
# | 	OpDecorate %32 LinkageAttributes "f1" Import
# | 	OpDecorate %36 LinkageAttributes "f2" Import
# | 	%5 = OpTypeInt 8 0
# | 	%6 = OpTypePointer CrossWorkgroup %5
# | 	%7 = OpTypeVoid
# | 	%8 = OpTypeFunction %7 %6
# | 	%9 = OpTypeFloat 16
# | 	%10 = OpTypeStruct %9
# | 	%11 = OpTypeFunction %10 %6 %10
# | 	%12 = OpTypePointer CodeSectionINTEL %11
# | 	%13 = OpTypePointer Function %5
# | 	%14 = OpTypeInt 32 0
# | 	%15 = OpConstant %14 3
# | 	%16 = OpTypeArray %13 %15
# | 	%17 = OpTypePointer CrossWorkgroup %16
# | 	%18 = OpTypePointer CrossWorkgroup %11
# | 	%19 = OpTypePointer Function %11
# | 	%20 = OpTypeStruct %19 %19 %19
# | 	%21 = OpTypeArray %19 %15
# | 	%22 = OpTypeInt 64 0
# | 	%23 = OpTypePointer CrossWorkgroup %20
# | 	%24 = OpTypePointer CrossWorkgroup %21
# | 	%25 = OpConstant %22 2
# | 	%26 = OpConstant %22 1
# | 	%27 = OpConstantNull %22
# | 	%31 = OpConstantFunctionPointerINTEL %12 %28
# | 	%35 = OpConstantFunctionPointerINTEL %12 %32
# | 	%39 = OpConstantFunctionPointerINTEL %12 %36
# | 	%40 = OpSpecConstantOp %19 Bitcast %31
# | 	%41 = OpSpecConstantOp %19 Bitcast %35
# | 	%42 = OpSpecConstantOp %19 Bitcast %39
# | 	%43 = OpConstantComposite %21 %40 %41 %42
# | 	%44 = OpVariable %24 CrossWorkgroup %43
# | 	%45 = OpConstantComposite %20 %40 %41 %42
# | 	%46 = OpVariable %23 CrossWorkgroup %45
# | 	%47 = OpUndef %10
# | 	%48 = OpTypePointer CrossWorkgroup %13
# | 	%49 = OpTypeStruct %13 %13 %13
# | 	%50 = OpTypePointer CrossWorkgroup %49
# | 	%51 = OpConstant %14 2
# | 	%52 = OpConstant %14 1
# | 	%53 = OpConstantNull %14
# | 	%54 = OpTypePointer CrossWorkgroup %19
# | 	%55 = OpSpecConstantOp %19 Bitcast %31
# | 	%56 = OpSpecConstantOp %19 Bitcast %35
# | 	%57 = OpSpecConstantOp %19 Bitcast %39
# | 	%58 = OpConstantComposite %21 %55 %56 %57
# | 	%59 = OpConstantComposite %20 %55 %56 %57
# | 	%28 = OpFunction %10 None %11
# | 	%29 = OpFunctionParameter %6
# | 	%30 = OpFunctionParameter %10
# | 	OpFunctionEnd
# | 	%32 = OpFunction %10 None %11
# | 	%33 = OpFunctionParameter %6
# | 	%34 = OpFunctionParameter %10
# | 	OpFunctionEnd
# | 	%36 = OpFunction %10 None %11
# | 	%37 = OpFunctionParameter %6
# | 	%38 = OpFunctionParameter %10
# | 	OpFunctionEnd
# | 	%61 = OpFunction %7 None %8             ; -- Begin function array
# | 	%60 = OpFunctionParameter %6
# | 	%2 = OpLabel
# | 	%62 = OpBitcast %17 %44
# | 	%63 = OpInBoundsPtrAccessChain %17 %62 %27
# | 	%64 = OpBitcast %18 %63
# | 	%65 = OpInBoundsPtrAccessChain %17 %62 %26
# | 	%66 = OpBitcast %18 %65
# | 	%67 = OpInBoundsPtrAccessChain %17 %62 %25
# | 	%68 = OpBitcast %18 %67
# | 	%69 = OpFunctionPointerCallINTEL %10 %64 %60 %47
# | 	%70 = OpFunctionPointerCallINTEL %10 %66 %60 %69
# | 	%71 = OpFunctionPointerCallINTEL %10 %68 %60 %70
# | 	OpReturn
# | 	OpFunctionEnd
# |                                         ; -- End function
# | 	%73 = OpFunction %7 None %8             ; -- Begin function struct
# | 	%72 = OpFunctionParameter %6
# | 	%3 = OpLabel
# | 	%74 = OpBitcast %48 %46
# | 	%75 = OpBitcast %54 %74
# | 	%76 = OpLoad %19 %75 Aligned 8
# | 	%77 = OpBitcast %50 %46
# | 	%78 = OpInBoundsPtrAccessChain %48 %77 %53 %52
# | 	%79 = OpBitcast %54 %78
# | 	%80 = OpLoad %19 %79 Aligned 8
# | 	%81 = OpInBoundsPtrAccessChain %48 %77 %53 %51
# | 	%82 = OpBitcast %54 %81
# | 	%83 = OpLoad %19 %82 Aligned 8
# | 	%84 = OpFunctionPointerCallINTEL %10 %76 %72 %47
# | 	%85 = OpFunctionPointerCallINTEL %10 %80 %72 %84
# | 	%86 = OpFunctionPointerCallINTEL %10 %83 %72 %85
# | 	OpReturn
# | 	OpFunctionEnd
# |                                         ; -- End function
# |                                         ; -- End function
# `-----------------------------
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/pointers/fun-with-aggregate-arg-in-const-init.ll
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/pointers/fun-with-aggregate-arg-in-const-init.ll:92:13: error: numeric variable with name 'f2GEP' already exists
# | ; CHECK: %[[f2GEP:]] = OpInBoundsPtrAccessChain %[[#GlobalInt8PtrPtrTy]] %[[#fnStructCast2]] %[[#I32Const0]] %[[#I32Const2]]
# |             ^
# `-----------------------------
# error: command failed with exit status: 2

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

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


More information about the llvm-commits mailing list