[all-commits] [llvm/llvm-project] d3ce9f: [CIR] Implement Direct+canFlatten in CallConvLowering
adams381 via All-commits
all-commits at lists.llvm.org
Thu Jun 25 17:03:52 PDT 2026
Branch: refs/heads/users/adams381/cir-callconv-lowering-flatten
Home: https://github.com/llvm/llvm-project
Commit: d3ce9f033060667b0a2c2febd7946560ec892533
https://github.com/llvm/llvm-project/commit/d3ce9f033060667b0a2c2febd7946560ec892533
Author: Adam Smith <adams at nvidia.com>
Date: 2026-06-25 (Thu, 25 Jun 2026)
Changed paths:
M clang/lib/CIR/Dialect/Transforms/TargetLowering/CIRABIRewriteContext.cpp
M clang/test/CIR/Transforms/abi-lowering/coerce-record-to-record-via-memory.cir
A clang/test/CIR/Transforms/abi-lowering/direct-flatten.cir
Log Message:
-----------
[CIR] Implement Direct+canFlatten in CallConvLowering
ArgKind::Direct with a multi-field coerced struct and the canFlatten flag
means the coerced struct is passed as one scalar wire argument per field.
CallConvLowering was passing it as a single aggregate, ignoring canFlatten.
A new getFlattenedCoercedType helper recognizes the Direct+canFlatten arg
shape. At the callee, insertArgCoercion replaces the single block argument
with N scalar block args, stores each into an alloca of the coerced struct
type, reloads it, and coerces back to the original argument type when the
coerced struct type differs from the original. The Ignore-drop loop and
updateArgAttrs account for the N block-argument slots a flattened arg
occupies; updateArgAttrs also shapes them on the sret return path.
At the call site, when the operand type differs from the coerced struct
type the operand is coerced through a memory slot and each field is read
from that slot with cir.get_member + cir.load (via a new emitCoercionToMemory
helper that returns the coerce-slot pointer without loading the whole
aggregate); when the types already match each field is extracted directly
from the value.
direct-flatten.cir exercises the two/three-field flatten, the x86-64 dim3
{i64, i32} packing, the call-site coerce-slot reads, an Ignore between two
flattened args, and the case where the argument type already equals the
coerced struct type (no back-coercion; fields extracted directly from the
value).
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