[flang-commits] [flang] [flang] Fix `getTypeSizeAndAlignment` for packed/tail-padded `RecordType` and `TRANSFER` gate (PR #220377)

via flang-commits flang-commits at lists.llvm.org
Thu Sep 3 12:52:59 PDT 2026


================
@@ -1661,15 +1663,40 @@ fir::getTypeSizeAndAlignment(mlir::Location loc, mlir::Type ty,
   if (auto recTy = mlir::dyn_cast<fir::RecordType>(ty)) {
     std::uint64_t size = 0;
     unsigned short align = 1;
+    if (recTy.isPacked()) {
+      // LLVM packed structs (<{ ... }>) place fields back-to-back with no
+      // inter-field alignment padding and no tail padding.  Each component
+      // still occupies its allocation size (llvm::alignTo(storeSize, ABI
+      // alignment)), because LLVM's packed StructLayout advances by
+      // getTypeAllocSize, not getTypeStoreSize.  For example, x86 f80 has
----------------
MattPD wrote:

The packed-type description and listed files are now accurate. The two-commit series still assigns the alloca-copy fix to the wrong commit. The message for `72c5dc04464d` says that commit adds the fix, but the alloca-copy code first appears in `eabf68933226`. Commit `72c5dc04464d` still contains the invalid direct load.

Could the commits be squashed, or could each message describe its own code accurately? The affected-caller inventory could also include the change to SystemZ argument passing.


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


More information about the flang-commits mailing list