[FE] Use preferred alignment instead of ABI alignment for complete object when applicable
authorXiangling Liao <Xiangling.Liao@ibm.com>
Wed, 30 Sep 2020 14:35:00 +0000 (10:35 -0400)
committerXiangling Liao <Xiangling.Liao@ibm.com>
Wed, 30 Sep 2020 14:48:28 +0000 (10:48 -0400)
commit3a7487f903e2a6be29de39058eee2372e30798d5
tree26000ad57bce61232e94b113d752e2ca226ae3ec
parent2ef73025afda6481625b74eb99cdbc2eb1cfef95
[FE] Use preferred alignment instead of ABI alignment for complete object when applicable

On some targets, preferred alignment is larger than ABI alignment in some cases. For example,
on AIX we have special power alignment rules which would cause that. Previously, to support
those cases, we added a “PreferredAlignment” field in the `RecordLayout` to store the AIX
special alignment values in “PreferredAlignment” as the community suggested.

However, that patch alone is not enough. There are places in the Clang where `PreferredAlignment`
should have been used instead of ABI-specified alignment. This patch is aimed at fixing those
spots.

Differential Revision: https://reviews.llvm.org/D86790
clang/include/clang/AST/ASTContext.h
clang/lib/AST/ASTContext.cpp
clang/lib/CodeGen/CGExprCXX.cpp
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/aix-alignment.c [new file with mode: 0644]
clang/test/CodeGenCXX/aix-alignment.cpp [new file with mode: 0644]