[all-commits] [llvm/llvm-project] 28efe2: [CIR] Store Expand fields into the parameter alloca

adams381 via All-commits all-commits at lists.llvm.org
Thu Jun 11 14:00:44 PDT 2026


  Branch: refs/heads/users/adams381/cir-callconv-lowering-expand
  Home:   https://github.com/llvm/llvm-project
  Commit: 28efe2d8a1a264b47b5ae23b75232522ea64f284
      https://github.com/llvm/llvm-project/commit/28efe2d8a1a264b47b5ae23b75232522ea64f284
  Author: Adam Smith <adams at nvidia.com>
  Date:   2026-06-11 (Thu, 11 Jun 2026)

  Changed paths:
    M clang/lib/CIR/Dialect/Transforms/TargetLowering/CIRABIRewriteContext.cpp
    M clang/test/CIR/Transforms/abi-lowering/expand-struct-arg.cir

  Log Message:
  -----------
  [CIR] Store Expand fields into the parameter alloca

Rework the callee-side reassembly of Expand (flattened-struct) arguments in
CallConvLowering.  Instead of building a scratch alloca, storing each field
into it, reloading the whole struct, and replacing the struct block
argument's uses, store each expanded field block argument directly into the
parameter's own alloca -- the slot CIRGen already spills the by-value struct
into -- and erase the original whole-struct store.  This keeps the alloca's
variable name and `init` flag and drops the reassemble-then-reload
roundtrip.  The struct argument's only use is that spill store, asserted
here.

At the call site, when an Expand operand is a load of an alloca, read each
member directly from that alloca (get_member + load) at the original load's
position and drop the now-dead whole-struct load; fall back to
cir.extract_member when the operand has no source alloca (a call result,
constant, etc.).

Also fold the Ignore-drop into a single forward running-index pass over the
block arguments (removing the precomputed index vector) and switch the
field iterations to llvm::append_range / llvm::enumerate.



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