[LLVMdev] Enabling the vectorizer for -Os

Reid Kleckner rnk at google.com
Wed Jun 5 06:22:26 PDT 2013


On Tue, Jun 4, 2013 at 11:26 PM, Nadav Rotem <nrotem at apple.com> wrote:

> The loop vectorizer is already aware of the ‘optsize’ attribute and it
> does not vectorize loops which require that we keep the scalar tail. It
> also does not unroll loops when optimizing for size. It is not obvious but
> there are many cases in which this conservative kind of vectorization is
> profitable.  The loop vectorizer does not try to estimate the encoding size
> of instructions and this is one reason for code growth.
>

Neat, I like this conservative approach to vectorization.  It seems like if
it's good enough for -Os it should be good enough for -O2.  I thought the
main objections against vectorization at -O2 centered around code bloat and
regressions of hot but short loops.  If these heuristics address those
concerns and compile time doesn't suffer too much, it seems reasonable to
enable at -O2.

My poorly informed 2 cents.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130605/53610f5f/attachment.html>


More information about the llvm-dev mailing list