[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: Windows-->
# :window: Windows x64 Test Results

* 129258 tests passed
* 2852 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
c:\_work\llvm-project\llvm-project\build\bin\clang.exe -cc1 -internal-isystem C:\_work\llvm-project\llvm-project\build\lib\clang\22\include -nostdsysteminc -triple spirv64-unknown-unknown -fcuda-is-device -emit-llvm -o - C:\_work\llvm-project\llvm-project\clang\test\CodeGen\varargs-with-nonzero-default-address-space.c | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\clang\test\CodeGen\varargs-with-nonzero-default-address-space.c
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\clang.exe' -cc1 -internal-isystem 'C:\_work\llvm-project\llvm-project\build\lib\clang\22\include' -nostdsysteminc -triple spirv64-unknown-unknown -fcuda-is-device -emit-llvm -o - 'C:\_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: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\clang\test\CodeGen\varargs-with-nonzero-default-address-space.c'
# .---command stderr------------
# | C:\_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: C:\_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 c:\_work\llvm-project\llvm-project\build\bin\llc.exe -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_INTEL_function_pointers < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\SPIRV\function\vararg.ll 2>&1 | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\SPIRV\function\vararg.ll
# executed command: not 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_INTEL_function_pointers
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\SPIRV\function\vararg.ll'
# .---command stderr------------
# | C:\_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: C:\_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
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -O0 -mtriple=spirv-- -disable-verify -debug-pass=Structure < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\SPIRV\llc-pipeline.ll 2>&1    | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe -match-full-lines -strict-whitespace -check-prefix=SPIRV-O0 C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\SPIRV\llc-pipeline.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -O0 -mtriple=spirv-- -disable-verify -debug-pass=Structure
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' -match-full-lines -strict-whitespace -check-prefix=SPIRV-O0 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\SPIRV\llc-pipeline.ll'
# .---command stderr------------
# | C:\_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: C:\_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
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -O0 -mtriple=spirv64-unknown-unknown C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\SPIRV\printf.ll -o - | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\SPIRV\printf.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -O0 -mtriple=spirv64-unknown-unknown 'C:\_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: c:\\_work\\llvm-project\\llvm-project\\build\\bin\\llc.exe -O0 -mtriple=spirv64-unknown-unknown C:\\_work\\llvm-project\\llvm-project\\llvm\\test\\CodeGen\\SPIRV\\printf.ll -o -
# | 1.	Running pass 'Function Pass Manager' on module 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\SPIRV\printf.ll'.
# | 2.	Running pass 'Module Verifier' on function '@foo'
# | Exception Code: 0xC000001D
# |  #0 0x00007ff696cfd606 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x2c7d606)
# |  #1 0x00007ffc01acbb04 (C:\Windows\System32\ucrtbase.dll+0x7bb04)
# |  #2 0x00007ffc01accad1 (C:\Windows\System32\ucrtbase.dll+0x7cad1)
# |  #3 0x00007ff694771c1b (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x6f1c1b)
# |  #4 0x00007ff694771a15 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x6f1a15)
# |  #5 0x00007ff69459a557 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x51a557)
# |  #6 0x00007ff694538df2 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x4b8df2)
# |  #7 0x00007ff694541ecd (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x4c1ecd)
# |  #8 0x00007ff694539ad1 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x4b9ad1)
# |  #9 0x00007ff694087c0c (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x7c0c)
# | #10 0x00007ff694084e86 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x4e86)
# | #11 0x00007ff6986b06e4 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x46306e4)
# | #12 0x00007ffc08e14cb0 (C:\Windows\System32\KERNEL32.DLL+0x14cb0)
# | #13 0x00007ffc1757edcb (C:\Windows\SYSTEM32\ntdll.dll+0x7edcb)
# `-----------------------------
# error: command failed with exit status: 0xc000001d
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\SPIRV\printf.ll'
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_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