[llvm-branch-commits] [clang] [CIR] Implement Direct+canFlatten in CallConvLowering (PR #201719)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Jun 12 09:05:20 PDT 2026
================
@@ -61,11 +88,20 @@ LogicalResult buildNewArgTypes(ArrayRef<Type> oldArgTypes,
Type origTy = oldArgTypes[idx];
switch (ac.kind) {
case ArgKind::Direct:
- // Direct with a coerced type means the wire signature uses the
- // coerced type; the body still expects origTy and we'll insert a
- // coercion at the entry block. Direct without a coerced type is a
- // true pass-through.
- newArgTypes.push_back(ac.coercedType ? ac.coercedType : origTy);
+ // Direct with canFlatten and a struct coerced type: push one wire type
+ // per field of the coerced struct rather than the struct itself.
+ // Single-field coerced structs fall through to the non-flatten path —
+ // the struct is already scalar-sized and flattening adds no value.
+ if (auto flatTy = getFlattenedCoercedType(ac)) {
----------------
adams381 wrote:
Spelled out `cir::RecordType`. Did the same at the other `getFlattenedCoercedType` call sites.
https://github.com/llvm/llvm-project/pull/201719
More information about the llvm-branch-commits
mailing list