[PATCH] D34454: SwiftAggregateLowering: Use type alloc size to determine the size of types

Arnold Schwaighofer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 21 08:32:02 PDT 2017


aschwaighofer created this revision.

The layout must be compatible with the input layout, offsets are defined in
terms of offsets within a packed struct which are computed in terms of the alloc
size of a type.

Using the store size we would insert padding for the following type for example:

struct {

  int3 v;
  long long l;

} __attribute((packed))

On x86-64 int3 is padded to int4 alignment. The swiftcc type would be
<{ <3 x float>, [4 x i8], i64 }> which is not compatible with <{ <3 x float>, i64 }>.

The latter has i64 at offset 16 and the former at offset 20.

rdar://32618125


https://reviews.llvm.org/D34454

Files:
  lib/CodeGen/SwiftCallingConv.cpp
  test/CodeGen/64bit-swiftcall.c
  test/CodeGen/windows-swiftcall.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34454.103389.patch
Type: text/x-patch
Size: 5743 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170621/6e4ffc86/attachment.bin>


More information about the cfe-commits mailing list