[clang] [llvm] [SPIR-V] Enable variadic function lowering for the SPIR-V target (PR #175076)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 8 14:18:03 PST 2026


github-actions[bot] wrote:

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

* 167829 tests passed
* 2978 tests skipped
* 4 tests failed

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

### Clang
<details>
<summary>Clang.CodeGen/varargs-with-nonzero-default-address-space.c</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/22/include -nostdsysteminc -triple spirv64-unknown-unknown -fcuda-is-device -emit-llvm -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/varargs-with-nonzero-default-address-space.c | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/varargs-with-nonzero-default-address-space.c
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/22/include -nostdsysteminc -triple spirv64-unknown-unknown -fcuda-is-device -emit-llvm -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/varargs-with-nonzero-default-address-space.c
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/varargs-with-nonzero-default-address-space.c
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/varargs-with-nonzero-default-address-space.c:17:16: error: CHECK-NEXT: expected string not found in input
# | // CHECK-NEXT: [[VARET:%.*]] = alloca i32, align 4
# |                ^
# | <stdin>:15:26: note: scanning from here
# |  %v = alloca i32, align 4
# |                          ^
# | <stdin>:36:29: note: possible intended match here
# |  store i32 %2, ptr addrspace(4) %v.ascast, align 4
# |                             ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/varargs-with-nonzero-default-address-space.c
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            .
# |            .
# |            .
# |           10: entry: 
# |           11:  %n.addr = alloca i32, align 4 
# |           12:  %ap = alloca ptr addrspace(4), align 8 
# |           13:  %t = alloca %struct.x, align 8 
# |           14:  %ap2 = alloca ptr addrspace(4), align 8 
# |           15:  %v = alloca i32, align 4 
# | next:17'0                              X error: no match found
# |           16:  %n.addr.ascast = addrspacecast ptr %n.addr to ptr addrspace(4) 
# | next:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           17:  %ap.ascast = addrspacecast ptr %ap to ptr addrspace(4) 
# | next:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           18:  %t.ascast = addrspacecast ptr %t to ptr addrspace(4) 
# | next:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           19:  %ap2.ascast = addrspacecast ptr %ap2 to ptr addrspace(4) 
# | next:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           20:  %v.ascast = addrspacecast ptr %v to ptr addrspace(4) 
# | next:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            .
# |            .
# |            .
# |           31:  %1 = getelementptr inbounds i8, ptr addrspace(4) %argp.cur1, i32 3 
# | next:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           32:  %argp.cur1.aligned = call ptr addrspace(4) @llvm.ptrmask.p4.i64(ptr addrspace(4) %1, i64 -4) 
# | next:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           33:  %argp.next2 = getelementptr inbounds i8, ptr addrspace(4) %argp.cur1.aligned, i64 4 
# | next:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           34:  store ptr addrspace(4) %argp.next2, ptr addrspace(4) %ap2.ascast, align 8 
# | next:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           35:  %2 = load i32, ptr addrspace(4) %argp.cur1.aligned, align 4 
# | next:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           36:  store i32 %2, ptr addrspace(4) %v.ascast, align 4 
# | next:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:17'1                                 ?                       possible intended match
# |           37:  call void @llvm.va_end.p4(ptr addrspace(4) %ap2.ascast) 
# | next:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           38:  call void @llvm.va_end.p4(ptr addrspace(4) %ap.ascast) 
# | next:17'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           39:  ret void 
# | next:17'0     ~~~~~~~~~~
# |           40: } 
# | next:17'0     ~~
# |           41:  
# | next:17'0     ~
# |            .
# |            .
# |            .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

### LLVM
<details>
<summary>LLVM.CodeGen/SPIRV/function/vararg.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
not /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/function/vararg.ll 2>&1 | /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/function/vararg.ll
# executed command: not /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
# note: command had no output on stdout or stderr
# error: command failed with exit status: 1
# 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/function/vararg.ll
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/function/vararg.ll:9:9: error: CHECK: expected string not found in input
# | ; CHECK:error: {{.*}} in function bar void (): SPIR-V does not support variadic functions
# |         ^
# | <stdin>:1:1: note: scanning from here
# | llvm.lifetime.start/end can only be used on alloca or poison
# | ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/function/vararg.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |          1: llvm.lifetime.start/end can only be used on alloca or poison 
# | check:9     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# |          2:  call void @llvm.lifetime.start.p0(ptr %vararg_buffer) 
# | check:9     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |          3: llvm.lifetime.start/end can only be used on alloca or poison 
# | check:9     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |          4:  call void @llvm.lifetime.end.p0(ptr %vararg_buffer) 
# | check:9     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |          5: in function bar 
# | check:9     ~~~~~~~~~~~~~~~~
# |          6: LLVM ERROR: Broken function found, compilation aborted! 
# | check:9     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |          .
# |          .
# |          .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>LLVM.CodeGen/SPIRV/llc-pipeline.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -O0 -mtriple=spirv-- -disable-verify -debug-pass=Structure < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/llc-pipeline.ll 2>&1    | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck -match-full-lines -strict-whitespace -check-prefix=SPIRV-O0 /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/llc-pipeline.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -O0 -mtriple=spirv-- -disable-verify -debug-pass=Structure
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck -match-full-lines -strict-whitespace -check-prefix=SPIRV-O0 /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/llc-pipeline.ll
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/llc-pipeline.ll:36:17: error: SPIRV-O0-NEXT: is not on the line after the previous match
# | ; SPIRV-O0-NEXT:    FunctionPass Manager
# |                 ^
# | <stdin>:26:1: note: 'next' match was here
# |     FunctionPass Manager
# | ^
# | <stdin>:24:35: note: previous match ended here
# |     SPIRV prepare global variables
# |                                   ^
# | <stdin>:25:1: note: non-matching line after previous match is here
# |     Expand variadic functions
# | ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/llc-pipeline.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |          .
# |          .
# |          .
# |         21:       Expand reduction intrinsics 
# |         22:       SPIR-V Regularizer 
# |         23:     SPIRV prepare functions 
# |         24:     SPIRV prepare global variables 
# |         25:     Expand variadic functions 
# |         26:     FunctionPass Manager 
# | next:36     !~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
# |         27:       Lower invoke and unwind, for unwindless code generators 
# |         28:       Remove unreachable blocks from the CFG 
# |         29:       SPIRV strip convergent intrinsics 
# |         30:     SPIRV Legalize Implicit Binding 
# |         31:     SPIRV Legalize Zero-Size Arrays 
# |          .
# |          .
# |          .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>LLVM.CodeGen/SPIRV/printf.ll</summary>

```
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -O0 -mtriple=spirv64-unknown-unknown /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/printf.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/printf.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -O0 -mtriple=spirv64-unknown-unknown /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/printf.ll -o -
# .---command stderr------------
# | llvm.lifetime.start/end can only be used on alloca or poison
# |   call void @llvm.lifetime.start.p0(ptr %vararg_buffer2)
# | llvm.lifetime.start/end can only be used on alloca or poison
# |   call void @llvm.lifetime.end.p0(ptr %vararg_buffer2)
# | llvm.lifetime.start/end can only be used on alloca or poison
# |   call void @llvm.lifetime.start.p0(ptr %vararg_buffer5)
# | llvm.lifetime.start/end can only be used on alloca or poison
# |   call void @llvm.lifetime.end.p0(ptr %vararg_buffer5)
# | llvm.lifetime.start/end can only be used on alloca or poison
# |   call void @llvm.lifetime.start.p0(ptr %vararg_buffer1)
# | llvm.lifetime.start/end can only be used on alloca or poison
# |   call void @llvm.lifetime.end.p0(ptr %vararg_buffer1)
# | llvm.lifetime.start/end can only be used on alloca or poison
# |   call void @llvm.lifetime.start.p0(ptr %vararg_buffer4)
# | llvm.lifetime.start/end can only be used on alloca or poison
# |   call void @llvm.lifetime.end.p0(ptr %vararg_buffer4)
# | llvm.lifetime.start/end can only be used on alloca or poison
# |   call void @llvm.lifetime.start.p0(ptr %vararg_buffer)
# | llvm.lifetime.start/end can only be used on alloca or poison
# |   call void @llvm.lifetime.end.p0(ptr %vararg_buffer)
# | llvm.lifetime.start/end can only be used on alloca or poison
# |   call void @llvm.lifetime.start.p0(ptr %vararg_buffer3)
# | llvm.lifetime.start/end can only be used on alloca or poison
# |   call void @llvm.lifetime.end.p0(ptr %vararg_buffer3)
# | in function foo
# | LLVM ERROR: Broken function found, compilation aborted!
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
# | Stack dump:
# | 0.	Program arguments: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -O0 -mtriple=spirv64-unknown-unknown /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/printf.ll -o -
# | 1.	Running pass 'Function Pass Manager' on module '/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/printf.ll'.
# | 2.	Running pass 'Module Verifier' on function '@foo'
# |  #0 0x000000000804e638 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:842:13
# |  #1 0x000000000804bd45 llvm::sys::RunSignalHandlers() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Signals.cpp:109:18
# |  #2 0x000000000804f401 SignalHandler(int, siginfo_t*, void*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:429:38
# |  #3 0x00007f8689858330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
# |  #4 0x00007f86898b1b2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
# |  #5 0x00007f868985827e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
# |  #6 0x00007f868983b8ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
# |  #7 0x0000000007fb0e15 llvm::report_fatal_error(llvm::Twine const&, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/ErrorHandling.cpp:137:5
# |  #8 0x0000000007fb0c56 (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc+0x7fb0c56)
# |  #9 0x000000000766d710 void llvm::VerifierSupport::WriteTs<llvm::Instruction const*, llvm::MDNode const*>(llvm::Instruction const* const&, llvm::MDNode const* const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/Verifier.cpp:275:0
# | #10 0x00000000075b5dc5 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1398:27
# | #11 0x00000000075bdd72 llvm::FPPassManager::runOnModule(llvm::Module&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1444:13
# | #12 0x00000000075b686c runOnModule /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1513:27
# | #13 0x00000000075b686c llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:531:44
# | #14 0x0000000004eb658c compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/tools/llc/llc.cpp:874:17
# | #15 0x0000000004eb3b23 main /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/tools/llc/llc.cpp:462:13
# | #16 0x00007f868983d1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
# | #17 0x00007f868983d28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
# | #18 0x0000000004eaf325 _start (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc+0x4eaf325)
# `-----------------------------
# error: command failed with exit status: -6
# 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/printf.ll
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  /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/printf.ll
# `-----------------------------
# 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/175076


More information about the cfe-commits mailing list