[PATCH] D53865: [LoopVectorizer] Improve computation of scalarization overhead.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 10 12:57:05 PST 2018


efriedma added a comment.

> My question then is how to fix this? My idea was to let the loop vectorizer keep thinking about these instructions as vectorized, while being aware of a later expansion during isel (perhaps ISelExpanded would be a better name than TargetScalarized?).

So there are basically two possible ways to model sequences like this:

1. The vectorizer models/emits the instructions as "vector" instructions, but gives a discount to back-to-back instructions which will be scalarized.
2. The vectorizer compares vector and scalar instructions based on the cost model, and explicitly scalarizes instruction sequences if they would be cheaper.

This patch implements the first possibility, but the second is more useful, I think; it's closer to how the underlying target actually works, and it composes with other cost modeling more easily.  For example, for some operations, a vector instruction exists, but it's only a little cheaper than transforming it into a extract+scalar+insert sequence.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53865/new/

https://reviews.llvm.org/D53865





More information about the llvm-commits mailing list