[cfe-commits] r51673 - in /cfe/trunk: lib/CodeGen/CodeGenTypes.cpp test/CodeGen/struct-x86-darwin.c test/CodeGen/struct.c

Eli Friedman eli.friedman at gmail.com
Thu May 29 14:29:48 PDT 2008

On Thu, May 29, 2008 at 1:24 PM, Devang Patel <dpatel at apple.com> wrote:
> On May 29, 2008, at 3:58 AM, Eli Friedman wrote:
>> Author: efriedma
>> Date: Thu May 29 05:58:49 2008
>> New Revision: 51673
>> URL: http://llvm.org/viewvc/llvm-project?rev=51673&view=rev
>> Log:
>> Always use packed structs.  This isn't really very nice, but there's
>> nothing fundamentally wrong with it. Emitting unpacked structs where
>> possible is more work for almost no practical benefit.
> It may cause performance degradation in real world.

I don't follow; this doesn't affect the alignment of loads.

>>  We'll probably
>> want to fix it at some point anyway, but it's low priority.
> Please add FIXME in the code.

Okay, I'll do that.

>> The issue with long double in particular is that LLVM thinks an X86 long
>> double is 10 bytes, while clang considers it for all purposes to be
>> either 12 or 16 bytes, depending on the platform, even in a packed
>> struct.
> I expect clang and LLVM to use same target data. Is it not true ?

When LLVM packs a struct, it appears to use the tightest packing
possible, which is in fact 10 bytes for an x86 long double.  The issue
is that gcc-compatible C struct layout doesn't allow packing them that
tightly (might be considered a bug, but not really something that can
be fixed at this point).  Not sure how to deal with it (it doesn't
show up with types with power-of-two width).


More information about the cfe-commits mailing list