[PATCH] Make getPreferredTypeAlign respect alignments specified with an aligned attribute on a typedef
st at quanttec.com
Fri Feb 21 09:22:22 PST 2014
On 14-02-12 22:21, Stephan Tolksdorf wrote:
> On 14-02-12 20:45, David Majnemer wrote:
>> This looks like the right place to fix the bug.
>> Three comments:
>> - The '*' for pointer types should be on the right side.
>> - AlignedAttr::getMaxAlignment() isn't always super fast but I guess
>> such typedefs are rare. An argument could be made that getTypeInfoImpl
>> should return a struct containing the size, alignment and whether or not
>> the type has an explicit alignment. Then, getPreferredTypeAlign() could
>> take advantage of it.
>> - Both of your tests in CodeGen/alignment.c already pass without your
> Thanks a lot for the review!
> I've moved the '*' to the right and split off the alignment.c changes
> into a separate patch.
> I suppose that typedefs with attributes are so rare that the overhead of
> the new getMaxAlignment call should be minimal.
> Please commit the patches if you think they are ready. (I don't have
> commit access.)
If you're concerned about the performance, I could also move the
getMaxAlignment call into the 'if (T == double || T == long long ||
...)' statement below and only call getMaxAlignment if ABIAlign !=
More information about the cfe-commits