[all-commits] [llvm/llvm-project] 9c1f9b: [CIR] Implement Direct+canFlatten in CallConvLowering

adams381 via All-commits all-commits at lists.llvm.org
Thu Jun 4 16:32:09 PDT 2026


  Branch: refs/heads/users/adams381/cir-callconv-lowering-flatten
  Home:   https://github.com/llvm/llvm-project
  Commit: 9c1f9bb4c3d768bd3fbb1d0607ae7d6587c5304d
      https://github.com/llvm/llvm-project/commit/9c1f9bb4c3d768bd3fbb1d0607ae7d6587c5304d
  Author: Adam Smith <adams at nvidia.com>
  Date:   2026-06-04 (Thu, 04 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

CallConvLowering previously ignored the canFlatten flag on Direct
classifications: a Direct arg with a multi-field struct coerced type was
passed as a single struct argument rather than N scalar register arguments.
This is the register-passing pattern the x86-64 SysV ABI uses for structs
like struct { long a, b; }.

A new helper getFlattenedCoercedType centralizes the detection (Direct,
multi-field struct coercedType, canFlatten set).  The three lowering sites
are updated: buildNewArgTypes pushes one wire type per field; insertArgCoercion
reassembles the coerced struct from N scalar block args then coerces to the
original type if the two differ; rewriteCallSite extracts each field via
cir.extract_member.  The existing coerce-record-to-record-via-memory.cir
test gains can_flatten = false to opt into the single-arg path.



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