[PATCH] Update InstCombine to transform aggregate loads into scalar loads.

Amaury SECHET deadalnix+llvmreview at gmail.com
Mon Apr 20 19:45:39 PDT 2015


================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:517
@@ +516,3 @@
+                                               ".unpack");
+      Instruction *V = InsertValueInst::Create(
+        UndefValue::get(T), NewLoad, 0, LI.getName());
----------------
reames wrote:
> 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.  
That would require the field to be at a variable position in the struct, which I don't think is supported.

Note that this piece of code is plugged AFTER the alignment is computed from the type for that very reason. Maybe I should add an assert to ensure alignment is set so it is won't break later.

http://reviews.llvm.org/D8339

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list