[all-commits] [llvm/llvm-project] e4c30c: [SPIRV] Extend lowering of variadic functions (#17...

Nick Sarnie via All-commits all-commits at lists.llvm.org
Fri Feb 13 10:22:47 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e4c30c15c87fb42432a614805d2e48ef39a8da00
      https://github.com/llvm/llvm-project/commit/e4c30c15c87fb42432a614805d2e48ef39a8da00
  Author: Nick Sarnie <nick.sarnie at intel.com>
  Date:   2026-02-13 (Fri, 13 Feb 2026)

  Changed paths:
    M llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp
    M llvm/lib/Transforms/IPO/ExpandVariadics.cpp
    A llvm/test/CodeGen/SPIRV/function/variadics-lowering-namespace-printf.ll
    M llvm/test/CodeGen/SPIRV/llc-pipeline.ll
    M llvm/test/CodeGen/SPIRV/printf.ll

  Log Message:
  -----------
  [SPIRV] Extend lowering of variadic functions (#178980)

Variadic function lowering for SPIR-V was initially added in
https://github.com/llvm/llvm-project/pull/175076.

However, I tried a full OpenMP offloading example that includes a vararg
call and hit a few issues:

1) The OpenMP Deivce library function `ompx::printf` was incorrectly
being considered a builtin `printf` function that would be handled
specifically by the SPIR-V backend.

The fix here is to remove the `printf` special handling.

2) We were getting an assert in ModuleVerifier saying the LLVM lifetime
intrinsics were being called with an argument that was neither an
`alloca` ptr or `poison`. The problem is the `alloca` was replaced with
a SPIR-V intrinsic `alloca` in `SPIRVPrepareFunctions`, but the lifetime
intrinsic added in `ExpandVariadics` was not lowered to the SPIR-V
lifetime intrinsic since `ExpandVariadics` is run after
`SPIRVPrepareFunctions`,

The fix here is to just run `ExpandVariadics` first.

3) There were `va` intrinsics taking in a `addrspace(4)` pointer that
were not being expanded.

The fix here is to extend `ExpandVariadics` to support expanding `va`
intrinsics with target-specific address spaces.

---------

Signed-off-by: Nick Sarnie <nick.sarnie at intel.com>
Co-authored-by: Joseph Huber <huberjn at outlook.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list