[PATCH] Make getPreferredTypeAlign respect alignments specified with an aligned attribute on a typedef

David Majnemer david.majnemer at gmail.com
Mon Feb 24 15:40:59 PST 2014


LGTM. I applied it in r202088.

On Fri Feb 21 2014 at 9:22:35 AM, Stephan Tolksdorf <st at quanttec.com> wrote:

> 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
> >> patch.
> >
> > 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.)
>
> Ping.
>
> 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 !=
> getTypeSize(T).
>
> - Stephan
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140224/d0c9361a/attachment.html>


More information about the cfe-commits mailing list