[clang] [clang][SPARC] Treat empty structs as if it's a one-bit type in the CC (PR #90338)

via cfe-commits cfe-commits at lists.llvm.org
Wed May 1 15:31:43 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));
----------------
koachan wrote:

Using `getInt64Ty` like that results in LLVM throwing these errors, it seems:
```
Function return type does not match operand type of return inst!
```

https://github.com/llvm/llvm-project/pull/90338


More information about the cfe-commits mailing list