[all-commits] [llvm/llvm-project] eb701a: [CIR] Expand callee-side va_arg on x86_64 (#222420)

Adam Smith via All-commits all-commits at lists.llvm.org
Mon Sep 21 17:07:17 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: eb701ae7fdf5071bf4b1dbde37a41fb16df49081
      https://github.com/llvm/llvm-project/commit/eb701ae7fdf5071bf4b1dbde37a41fb16df49081
  Author: Adam Smith <adams at nvidia.com>
  Date:   2026-09-22 (Tue, 22 Sep 2026)

  Changed paths:
    M clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
    M clang/lib/CIR/Dialect/Transforms/TargetLowering/CIRABIRewriteContext.cpp
    M clang/lib/CIR/Dialect/Transforms/TargetLowering/CIRABIRewriteContext.h
    A clang/test/CIR/CodeGen/call-conv-lowering-x86_64-vaarg-non-pod-nyi.cpp
    M clang/test/CIR/CodeGen/complex.cpp
    M clang/test/CIR/CodeGen/var-arg-aggregate.c
    A clang/test/CIR/CodeGen/var-arg-direct-offset.cpp
    A clang/test/CIR/CodeGen/var-arg-empty.c
    A clang/test/CIR/CodeGen/var-arg-int128.c
    A clang/test/CIR/CodeGen/var-arg-long-double.c
    A clang/test/CIR/CodeGen/var-arg-vector.c
    M clang/test/CIR/CodeGen/var_arg.c
    A clang/test/CIR/Transforms/abi-lowering/x86_64-vaarg-valist-shape-nyi.cir
    M llvm/include/llvm/ABI/FunctionInfo.h
    M llvm/lib/ABI/Targets/X86.cpp
    M mlir/include/mlir/ABI/ABIRewriteContext.h

  Log Message:
  -----------
  [CIR] Expand callee-side va_arg on x86_64 (#222420)

CallConvLowering now classifies every `cir.va_arg` on its own, as an
unnamed argument with a full register budget, and expands it in place. A
fetch that fits the budget reads from the saved register area, and
everything else reads the overflow area and bumps the cursor. An
aggregate, an x87 long double, and an `__int128` all lower correctly
now. Each fetch reads at the alignment the argument area gives it, which
for an over-aligned record is higher than its type reports.

A non-trivially-copyable type still reports NYI.

`rewriteVAArg` takes the register demand from the ABI library rather
than rebuilding it from the shape of the coerced type. The library
computes it in `classifyArgumentType` as the `NeededInt` and `NeededSSE`
out-parameters and used to drop it, so `llvm::abi::ArgInfo` and
`mlir::abi::ArgClassification` now carry it. Expanding a `cir.va_arg`
needs the inputs to that decision rather than its result, because the
choice has to become a runtime branch on the va_list cursor.

Assisted-by: Cursor / claude-opus-5



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