LLVM flags for Vectorization

Hi,

I have been analyzing the LLVM vectorizer by running some benchmarks. For vectorization, I have used the following flags:

-O3
-ffast-math
-mavx2

Am I missing any other flags which will improve vectorizer performance?

Thanks,
Santanu Das

IIT Hyd

Hi Santanu,

These flags should be enough for Clang to vectorise your code based on
AVX2 support.

If that doesn't give you the vectorisation you want, you can try to
force the vector width or unroll factor by either command line options
or pragmas in the code:

http://llvm.org/docs/Vectorizers.html

If you don't understand why a loop is not being vectorised, you can
try the Clang diagnostics:

And, of course, if you spot a loop or a basic block that could have
been vectorised but wasn't, please open a bug on our bugzilla with the
results of the diagnostics and your experimentation with widths and
factors:

https://llvm.org/bugs/

Hope that helps.

cheers,
--renato

Hi Renato,

Thanks a lot for your help! I will perform some experimentation with pragma directives as suggested by you.

Regards,

Santanu