[clang] [llvm] [LLVMAABI][AARCH64] Handle homogeneous aggregate return types (PR #218799)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 8 12:49:32 PDT 2026
================
@@ -82,3 +89,123 @@ bool TargetInfo::maybeCommonClassifyReturnType(FunctionInfo &FI) const {
return false;
}
+
+namespace {
+
+bool isEmptyRecordForHA(const Type *Ty) {
+ const auto *RT = dyn_cast<RecordType>(Ty);
+ return RT && RT->isEmpty();
+}
+
+/// Storage-container width mirroring Clang's ASTContext::getTypeSize for the
+/// types that matter to homogeneous-aggregate detection.
+uint64_t getHATypeSizeInBits(const Type *Ty) {
+ if (const auto *VT = dyn_cast<VectorType>(Ty)) {
+ uint64_t EltWidth = VT->getElementType()->getSizeInBits().getFixedValue();
+ uint64_t Width = std::max<uint64_t>(
+ 8, EltWidth * VT->getNumElements().getKnownMinValue());
+ if (Width & (Width - 1))
+ Width = alignTo(Width, bit_ceil(Width));
+ return Width;
+ }
+ return Ty->getSizeInBits().getFixedValue();
+}
+
+} // namespace
+
+bool TargetInfo::isHomogeneousAggregate(const Type *Ty, const Type *&Base,
+ uint64_t &Members) const {
----------------
efriedma-quic wrote:
Matrix types are a recent clang extension, and not part of Arm's documented ABI, so probably nobody really looked that closely at how they behave.
https://github.com/llvm/llvm-project/pull/218799
More information about the cfe-commits
mailing list