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

Quentin Colombet qcolombet at apple.com
Fri Oct 24 15:57:07 PDT 2014


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?

Thanks,
-Quentin

http://reviews.llvm.org/D5921






More information about the llvm-commits mailing list