[all-commits] [llvm/llvm-project] 6326f1: [CIR] Lower variadic calls in CallConvLowering for...
Adam Smith via All-commits
all-commits at lists.llvm.org
Tue Aug 4 11:04:18 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6326f14cdc12babfdc4359f5ddd4dfcd66b53f33
https://github.com/llvm/llvm-project/commit/6326f14cdc12babfdc4359f5ddd4dfcd66b53f33
Author: Adam Smith <adams at nvidia.com>
Date: 2026-08-04 (Tue, 04 Aug 2026)
Changed paths:
M clang/docs/CIR/ABILowering.rst
M clang/include/clang/CIR/Dialect/IR/CIROps.td
M clang/include/clang/CIR/Interfaces/CIROpInterfaces.td
M clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
M clang/lib/CIR/Dialect/Transforms/TargetLowering/CIRABIRewriteContext.cpp
A clang/test/CIR/CodeGen/call-conv-lowering-x86_64-variadic.c
M clang/test/CIR/Transforms/abi-lowering/indirect-call-classification-attr.cir
M clang/test/CIR/Transforms/abi-lowering/variadic-call-nyi.cir
A clang/test/CIR/Transforms/abi-lowering/x86_64-indirect-try-call.cir
A clang/test/CIR/Transforms/abi-lowering/x86_64-variadic-call.cir
A clang/test/CIR/Transforms/abi-lowering/x86_64-variadic-nyi.cir
M mlir/include/mlir/ABI/ABIRewriteContext.h
M mlir/include/mlir/ABI/Targets/Test/TestTarget.h
M mlir/lib/ABI/Targets/Test/TestTarget.cpp
Log Message:
-----------
[CIR] Lower variadic calls in CallConvLowering for x86_64 (#213315)
CallConvLowering classified each function once from its declared
signature and reused that classification at every call site. An argument
passed through an ellipsis has no entry in the callee's parameter list,
so on x86_64 an ellipsis argument that needed an extension attribute, a
register coercion, or a byval slot was emitted unchanged whenever the
callee's declared parameters happened to need no rewrite, and reported
NYI when they did.
An ellipsis argument competes for the same registers as a declared one,
so the same two-eightbyte record goes in a register pair early in the
list and byval once the integer registers are gone. Variadic call sites
under the x86_64 driver are now classified from the call's own operand
types, and the declared parameter count reaches
`llvm::abi::FunctionInfo::create` as its `NumRequired` argument, which
is what lets the classifier tell a named argument from one passed
through the ellipsis. Today that flag only decides whether a large
vector goes in a register, and the CIR type bridge admits no vector
types, so the boundary changes no output yet.
`prependIndirectCallee` also rebuilt the callee pointer's pointee
without `isVarArg`, dropping the ellipsis from a lowered indirect call
and with it the vector-register count the x86_64 SysV ABI passes in AL.
A void return and a return the ABI drops, such as an empty record, both
classify as `Ignore` while needing opposite treatment, so
`FunctionClassification` now records which one it was where the
classification is produced. `needsRewrite` moves from the CIR rewriter
to `mlir/include/mlir/ABI/ABIRewriteContext.h`, over a new per-argument
`isPassThrough`, so the pass and the rewriter share one definition.
Two things are newly diagnosed rather than newly broken. The
operand-count check moves ahead of the pass-through early return, so a
call whose operand count disagrees with a `no_proto` callee's
declaration is reported instead of lowered with operands the
classification never covered. And the indirect-call walk visits
`cir::CIRCallOpInterface` rather than only `cir.call`, so a variadic
indirect `cir.try_call` is accounted for, and one that needs a rewrite
is reported instead of left as written while the signature around it is
coerced. A non-variadic indirect `cir.try_call` is filtered out where
the walk collects, since rewriting one is unimplemented either way and
that gap has nothing to do with the ellipsis. Reported NYI: variadic
indirect calls that need a rewrite, variadic calls under the other
drivers, and an ellipsis argument whose ABI coercion the type bridge
cannot represent.
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