[LLVMdev] Enabling the vectorizer for -Os

David Tweed david.tweed at arm.com
Thu Jun 6 00:59:25 PDT 2013


On Wed, Jun 5, 2013 at 5:51 PM, Nadav Rotem <nrotem at apple.com> wrote:
> Hi,
>
> Thanks for the feedback.  I think that we agree that vectorization on -Os
> can benefit many programs. Regarding -O2 vs -O3, maybe we should set a
> higher cost threshold for O2 to increase the likelihood of improving the
> performance ?  We have very few regressions on -O3 as is and with better
> cost models I believe that we can bring them close to zero, so I am not
sure
> if it can help that much.   Renato, I prefer not to estimate the encoding
> size of instructions. We know that vector instructions take more space to
> encode. Will knowing the exact number help us in making a better decision
?
> I don't think so. On modern processors when running vectorizable loops,
the
> code size of the vector instructions is almost never the bottleneck.

| You're talking about -Os, where the user has explicitly asked the
| compiler to optimize the code size. Saying that the code size isn't a
| speed bottleneck seems to miss the point.

Just to check: reading Nadav's original paragraph, he appears to be talking
about O2 at this point, where the user (in my understanding) only cares
about size indirectly in terms of if it affects performance. Now having said
that I don't actually have a feeling for whether vectorizable code size
affects performance noticeably or not. My suspicion is that in C-family like
languages there's so much other faffing around instructions that any change
is probably lost in the noise. However, for LLVM IR generated directly it
might be noticeable, I'm really don't know.

But if it's a "performance reliable" optimization (as it seems to be) then I
think there's a good case for putting vectorization into the O2 opts.

Cheers,
Dave
>








More information about the llvm-dev mailing list