[all-commits] [llvm/llvm-project] ceb21f: [ARM] Fix how size-0 bitfields affect homogeneous ...
Simon Tatham via All-commits
all-commits at lists.llvm.org
Fri Jun 10 03:27:14 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ceb21fa4e49ddc8478371b41250f206082c5c67e
https://github.com/llvm/llvm-project/commit/ceb21fa4e49ddc8478371b41250f206082c5c67e
Author: Simon Tatham <simon.tatham at arm.com>
Date: 2022-06-10 (Fri, 10 Jun 2022)
Changed paths:
M clang/lib/CodeGen/ABIInfo.h
M clang/lib/CodeGen/TargetInfo.cpp
A clang/test/CodeGen/homogeneous-aggregates.c
Log Message:
-----------
[ARM] Fix how size-0 bitfields affect homogeneous aggregates.
By both AAPCS32 and AAPCS64, the test for whether an aggregate
qualifies as homogeneous (either HFA or HVA) is based on the data
layout alone. So any logical member of the structure that does not
affect the data layout also should not affect homogeneity. In
particular, an empty bitfield ('int : 0') should make no difference.
In fact, clang considered it to make a difference in C but not in C++,
and justified that policy as compatible with gcc. But that's
considered a bug in gcc as well (at least for Arm targets), and it's
fixed in gcc 12.1.
This fix mimics gcc's: zero-sized bitfields are now ignored in all
languages for the Arm (32- and 64-bit) ABIs. But I've left the
previous behaviour unchanged in other ABIs, by means of adding an
ABIInfo::isZeroLengthBitfieldPermittedInHomogeneousAggregate query
method which the Arm subclasses override.
Reviewed By: lenary
Differential Revision: https://reviews.llvm.org/D127197
More information about the All-commits
mailing list