[PATCH] Update InstCombine to transform aggregate loads into scalar loads.
mehdi.amini at apple.com
Mon Apr 20 20:40:06 PDT 2015
> On Apr 20, 2015, at 6:51 PM, Philip Reames <listmail at philipreames.com> wrote:
> Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:517
> @@ +516,3 @@
> + ".unpack");
> + Instruction *V = InsertValueInst::Create(
> + UndefValue::get(T), NewLoad, 0, LI.getName());
> deadalnix wrote:
>> reames wrote:
>>> You're missing the setPointerOperand step. Technically, the first element doesn't have to start at the beginning of the object. I think this is fine in practice, but there's a theoretical issue here.
>> I'm not sure how this is possible at all.
> Unless the struct is packed, the data layout alignment could require that the internal field be aligned to a higher alignment than the struct. This would be a weird arrangement, but I believe it's possible.
I thought the structure alignment was computed as the largest individual member alignment.
I think the relevant function is StructLayout::StructLayout(StructType *ST, const DataLayout &DL), and it seems to me that it always places the first element with a 0 offset.
Is there another way to force the structure alignment?
More information about the llvm-commits