[PATCH] [CodeGenPrepare] Move extractelement close to store if they can be combined.

hfinkel at anl.gov hfinkel at anl.gov
Sun Oct 26 01:21:58 PDT 2014


>>! In D5921#13, @qcolombet wrote:
> Hi Hal,
> 
> I think I have incorporated all your feedbacks with this update.
> However, I would like your opinion on the target hook. In particular, I realized that we are missing a correlation to an alignment.
> Indeed, we can imagine targets that can perform the store(extract) only on certain alignment (which is not the case for ARM, it supports unaligned memory accesses for vector).
> I thought about adding another out parameter for the alignment, but I was thinking that some targets can have a different cost for different alignment. Therefore, that wouldn't be sufficient.
> 
> I think we could either:
> 1. Have an out parameter (or another getter) that is a map of alignment => cost (sounds expensive though).
> 2. Have a second target hook that gives the actual cost when we know the alignment.
> 
> Assuming we go for #2, the general approach would be:
> - Check that the target supports the store(extract) combine for the given vector type and index (no cost involved).
> - Find an opportunity.
> - Check for the cost of this combine.
> - Promote or not according to the profitability.
> 
> What do you think?

I think that, for the time being, call TLI's existing allowsMisalignedMemoryAccesses hook, and only perform the transformation if the function returns true, and also Fast == true. Otherwise, abort. If someone needs more control than this, then we'll have a concrete use case and can design around that.

> 
> Thanks,
> -Quentin

http://reviews.llvm.org/D5921






More information about the llvm-commits mailing list