The current check for typedef is naive and doesn't deal with any convoluted cases. This patch makes use of the new 'AlignRequirement' enum field from 'TypeInfo' to determine whether or not this is an 'aligned' attribute on a typedef.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Thanks. This is an NFC patch, the tests added in https://reviews.llvm.org/D107598 should still suffice IMHO.
Comment Actions
Oh, no, I don't think this is NFC. It seems very likely that there's some case where the behavior is distinguishable. Maybe a typedef of a record with an alignment attribute?
__attribute__((aligned(2), packed)) struct float4 { float x, y, z, w; }; typedef struct float4 float4typedef; struct { float4typedef field; // presumably still eligible for alignment upgrade };
Comment Actions
Right, the behaviour difference is exactly what I'm trying to fix, silly me :). Though the diff isn't very obvious in the given example because ABIAlign equals to PreferredAlign in that particular case, the following test may provide a better exposure,
struct __attribute__((aligned(2))) S { double x; }; typedef struct S SS;