[all-commits] [llvm/llvm-project] e92e17: [CIR] Fixup conversion of const unions/structs of ...

Erich Keane via All-commits all-commits at lists.llvm.org
Mon Jul 20 14:53:31 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e92e1787bd87ab1fb631f1dc242308f7bede9b16
      https://github.com/llvm/llvm-project/commit/e92e1787bd87ab1fb631f1dc242308f7bede9b16
  Author: Erich Keane <ekeane at nvidia.com>
  Date:   2026-07-20 (Mon, 20 Jul 2026)

  Changed paths:
    M clang/include/clang/CIR/LoweringHelpers.h
    M clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
    M clang/lib/CIR/Lowering/LoweringHelpers.cpp
    M clang/test/CIR/CodeGen/anonymous-nested-init.c
    M clang/test/CIR/CodeGen/record-with-padded-union.cpp

  Log Message:
  -----------
  [CIR] Fixup conversion of const unions/structs of unions (#210146)

Now that we represent a union as all of the fields, it is possible for
the non-storage type to be initialized, so the fact that we were
lowering the types as storage in 1 way for the constant type, but
filling it with our actual value was wrong.

This patch makes sure we create a literal struct type for LLVM for union
types where they don't match, which generally matches the OGCG
implementation/output.

I've also generalized the work for the FAM to do this conversion, and
moved it to LoweringHelpers, so that our ConstantRecord lowering can use
it too.

This patch fixes up a couple uses of std::string initializers where they
fit in the SSO.

Note: I was assisted in this by Claude Opus. I did plenty of self-review
on this as it was being generated, and a post-review, but hopefully I
didn't miss anything.



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