[PATCH] D28975: [LV] Introducing VPlan to model the vectorized code and drive its transformation
Renato Golin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 23 01:31:28 PST 2017
rengolin added a comment.
In https://reviews.llvm.org/D28975#684385, @jonpa wrote:
> I have been working with improving cost estimates in the LoopVectorizer a bit. I wonder if VPlan will improve cost estimation for different VFs, including 1?
AFAICT, VPlan is completely orthogonal to the cost computation, ie. the exact same cost functions will be used (including 1).
> One issue currently that I don't know yet quite how to tackle, is that two scalarized instructions (def->use), have too big of scalarization costs computed, since the inserts from the first, and the extracts of the second will be optimized away. There are also several other minor issues I have found so far.
This is a known issue with any heuristics based approach, which is the case here. The high costs (for specific architectures) are expecting shuffles to be generated, but on other architectures you get for free. Overriding the cost per arch (or sub-arch) helps a bit (and that's what we use), but it doesn't cover cases based on the right sequence of instructions, at least not in any formalised way.
The only generic way of doing this is to allow targets to inspect the basic block for the expected sequences (so for example, ext+add has a free ext but ex+mov doesn't). This would require table gen descriptions of the patterns and could considerably increase the cost computation (but that's a target-specific decision, so it's ok).
> I guess I should probably wait for VPlan to arrive before trying anything... Is that going to be anytime soon?
Being orthogonal, I don't expect your cost investigations to have a large impact on the VPlan implementation. Maybe if you could open a new RFC with your proposal, we could go through it and see how much it'll actually impact.
More information about the llvm-commits