[clang] [clang][SPARC] Treat empty structs as if it's a one-bit type in the CC (PR #90338)
Sergei Barannikov via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 29 14:26:34 PDT 2024
================
@@ -263,7 +263,10 @@ SparcV9ABIInfo::classifyType(QualType Ty, unsigned SizeLimit) const {
CoerceBuilder CB(getVMContext(), getDataLayout());
CB.addStruct(0, StrTy);
- CB.pad(llvm::alignTo(CB.DL.getTypeSizeInBits(StrTy), 64));
+ // All structs, even empty ones, should take up a register argument slot,
+ // so pin the minimum struct size to one bit.
+ CB.pad(llvm::alignTo(
+ std::max(CB.DL.getTypeSizeInBits(StrTy).getKnownMinValue(), 1UL), 64));
----------------
s-barannikov wrote:
A slightly more cleaner way of handling this would be to
`return ABIArgInfo::getDirect(llvm::Type::getInt64Ty(getVMContext()));`
early.
https://github.com/llvm/llvm-project/pull/90338
More information about the cfe-commits
mailing list