This patch fixes what looks like a bug in IRGen's member initialization where it uses the alignment of a complete object instead of its non-virtual alignment when emitting the base constructor.
For example, when emitting the base constructor for B, IRGen uses a 16-byte alignment to initialize B::x because B's alignment is 16-byte (which is because A is 16-byte aligned). This is not correct since A is a virtual base of B and therefore we cannot guarantee that the pointer to B that is passed to the base constructor is always 16-byte aligned.
struct A { __attribute__((aligned(16))) double data1; }; struct B : public virtual A { B() : x(123) {} double a; int x; }; struct C : public virtual B {}; void test() { B b; C c; }
To fix the bug, this patch calls CGF.MakeNaturalAlignPointeeAddrLValue in EmitMemberInitializer to create an LValue that uses the non-virtual alignment of the class.
rdar://problem/36382481