[all-commits] [llvm/llvm-project] 0d62df: [CIR] Honor Direct coercion offset in callconv

adams381 via All-commits all-commits at lists.llvm.org
Fri Jun 12 13:59:57 PDT 2026


  Branch: refs/heads/users/adams381/cir-callconv-lowering-direct-offset
  Home:   https://github.com/llvm/llvm-project
  Commit: 0d62dff01d4ad8c3e0f4a7885665ed9c8519137a
      https://github.com/llvm/llvm-project/commit/0d62dff01d4ad8c3e0f4a7885665ed9c8519137a
  Author: Adam Smith <adams at nvidia.com>
  Date:   2026-06-12 (Fri, 12 Jun 2026)

  Changed paths:
    M clang/lib/CIR/Dialect/Transforms/TargetLowering/CIRABIRewriteContext.cpp
    A clang/test/CIR/Transforms/abi-lowering/coerce-direct-offset.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] Honor Direct coercion offset in callconv

A Direct classification with a coerced type assumed the coerced value
started at byte 0 of the original aggregate.  On x86-64 SysV a 16-byte
record whose low eightbyte is NO_CLASS carries its live value in the high
eightbyte and is classified as getDirect(coerceType, offset=8); the
coercion path read and wrote the wrong eightbyte for that shape.

Add a directOffset to ArgClassification (with a getDirect(coerced, offset)
overload).  emitCoercionToMemory now applies the offset to the coerced
(scalar) side of the slot via a u8 ptr_stride before the typed view, so the
aggregate side stays at offset 0 while the scalar is read from / written to
the right bytes.  The offset is threaded through both emitCoercion overloads,
insertReturnCoercion, and the call-site and entry-block Direct arms.  Offset
0 takes the original plain-bitcast path and is byte-identical to before.

The Test target parser gains an optional direct_offset key so cir-opt can
inject this classification; coerce-direct-offset.cir covers the offset-8
return and argument plus an offset-0 negative case.



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