[all-commits] [llvm/llvm-project] e4315a: [CIR] Accept a union covered only by a bit-field's...

Adam Smith via All-commits all-commits at lists.llvm.org
Mon Sep 14 09:05:23 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e4315a87a4128cc36470b2cb5c6009672df5f447
      https://github.com/llvm/llvm-project/commit/e4315a87a4128cc36470b2cb5c6009672df5f447
  Author: Adam Smith <adams at nvidia.com>
  Date:   2026-09-14 (Mon, 14 Sep 2026)

  Changed paths:
    M clang/include/clang/CIR/Dialect/IR/CIRTypes.td
    M clang/lib/CIR/Dialect/IR/CIRTypes.cpp
    M clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
    A clang/test/CIR/CodeGen/call-conv-lowering-x86_64-union-bitfield.c
    A clang/test/CIR/CodeGen/call-conv-lowering-x86_64-union-bitfield.cpp
    M clang/test/CIR/Transforms/abi-lowering/x86_64-aggregate-nyi.cir
    M clang/test/CIR/Transforms/abi-lowering/x86_64-union.cir

  Log Message:
  -----------
  [CIR] Accept a union covered only by a bit-field's declared type (#222108)

The size of a union is calculated by its largest member. When that
member is a bit-field, the unit storing it can be narrower than the type
it was declared with, and it is the declared type that accounts for the
union's bytes. BitFieldType gains a query for that declared type, and
the x86_64 union rule reads it rather than the stored size, so `union {
int x : 3; }` and `union { int x : 3; char c; }` now both pass as i32.

A union larger than one eightbyte still needs a member covering it
outright, since the coerce basis skips the entry carrying the
declaration.

Assisted-by: Cursor / claude-opus-5



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