[llvm-dev] load/stores adjusted to align - prevent aggregate replacement/elimination

Uday Kumar Reddy B via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 3 11:53:52 PDT 2019


Hello,

This is a question reg. replacement of malloc'ed single element arrays
by scalars, which LLVM's opt appears to normally perform well. Now,
when there are arrays of vector types with elements of size 32 bytes
or more (eg <8 x float> *), it's common to adjust load/store's so that
they align on element type boundaries (since GNU malloc would
typically align only to 16 byte boundaries, say on x86-64). On such
IR, I notice that the scalar replacement / register promotion of a
malloc'ed vector element doesn't work any more.

https://godbolt.org/z/9KByAf
(Commenting out the alignment adjustment makes it work perfectly.)

Are there any attributes/hints that might be used in generating those
alignment arithmetic instructions to help the optimizer here?

Thanks,
~ Uday


More information about the llvm-dev mailing list