[all-commits] [llvm/llvm-project] 651e5a: [MS] Fix passing aligned records by value in some ...

Reid Kleckner via All-commits all-commits at lists.llvm.org
Tue Jun 13 12:55:42 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 651e5ae62d29fdb07eb85f75ab7e686b98479f3a
      https://github.com/llvm/llvm-project/commit/651e5ae62d29fdb07eb85f75ab7e686b98479f3a
  Author: Reid Kleckner <rnk at google.com>
  Date:   2023-06-13 (Tue, 13 Jun 2023)

  Changed paths:
    M clang/lib/CodeGen/TargetInfo.cpp
    M clang/test/CodeGen/X86/x86_32-arguments-win32.c

  Log Message:
  -----------
  [MS] Fix passing aligned records by value in some cases

It's not exactly clear what the meaning of TypeInfo::AlignRequirement
is, so go directly to the ASTRecordLayout for records and check the
required alignment there. Compare that number with the stack alignment
value of 4.

This fixes cases when the alignment attribute does not appear directly
on the record [1], or when the attribute on the record is underaligned
[2].

[1]: `struct Foo { int __declspec(align(16)) x; };`
[2]: `struct __declspec(align(1)) Bar { int x; };`

Fixes https://llvm.org/pr63257

Differential Revision: https://reviews.llvm.org/D152752




More information about the All-commits mailing list