diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2016-08-15 07:20:40 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2016-08-15 07:20:40 +0000 |
| commit | b439dfe6babc77800d9f71d0dc5d4ef6cf676a46 (patch) | |
| tree | 8f43ac18a9304e3785292e8111377d18f65578b9 | |
| parent | b229cb0a43176dc75cc3883b1595c19e919ce00b (diff) | |
| download | bcm5719-llvm-b439dfe6babc77800d9f71d0dc5d4ef6cf676a46.tar.gz bcm5719-llvm-b439dfe6babc77800d9f71d0dc5d4ef6cf676a46.zip | |
[CodeGen] Ignore unnamed bitfields before handling vector fields
We processed unnamed bitfields after our logic for non-vector field
elements in records larger than 128 bits. The vector logic would
determine that the bit-field disqualifies the record from occupying a
register despite the unnamed bit-field not participating in the record
size nor its alignment.
N.B. This behavior matches GCC and ICC.
llvm-svn: 278656
| -rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 9 | ||||
| -rw-r--r-- | clang/test/CodeGen/x86_64-arguments.c | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 7b22ddc431c..bdf3e4b1eae 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -2589,6 +2589,10 @@ void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase, uint64_t Offset = OffsetBase + Layout.getFieldOffset(idx); bool BitField = i->isBitField(); + // Ignore padding bit-fields. + if (BitField && i->isUnnamedBitfield()) + continue; + // AMD64-ABI 3.2.3p2: Rule 1. If the size of an object is larger than // four eightbytes, or it contains unaligned fields, it has class MEMORY. // @@ -2621,10 +2625,7 @@ void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase, // structure to be passed in memory even if unaligned, and // therefore they can straddle an eightbyte. if (BitField) { - // Ignore padding bit-fields. - if (i->isUnnamedBitfield()) - continue; - + assert(!i->isUnnamedBitfield()); uint64_t Offset = OffsetBase + Layout.getFieldOffset(idx); uint64_t Size = i->getBitWidthValue(getContext()); diff --git a/clang/test/CodeGen/x86_64-arguments.c b/clang/test/CodeGen/x86_64-arguments.c index de7cfd9d579..9f375d780c9 100644 --- a/clang/test/CodeGen/x86_64-arguments.c +++ b/clang/test/CodeGen/x86_64-arguments.c @@ -536,3 +536,12 @@ void f64() { f64_helper(x64, x64, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0i); f64_helper(x64, x64, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0i); } + +struct t65 { + __m256 m; + int : 0; +}; +// SSE-LABEL: @f65(%struct.t65* byval align 32 %{{[^,)]+}}) +// AVX: @f65(<8 x float> %{{[^,)]+}}) +void f65(struct t65 a0) { +} |

