How to analyze loop vectorization failure messages?

Viewed 93

When compiling with clang-12 and trying to see why the loop is not vectorized sometimes it is somewhat complicated to get what exactly went wrong and how to fix it. For example value that could not be identified as reduction is used outside the loop. Is there a way to get more detailed information about what exactly went wrong?

EDIT001: An example. Just for lulz, I dont want an answer to this concrete example, I would like to get how to approach such a problem. https://godbolt.org/z/ajqdov83d

1 Answers

Looks like that the only option here is to use Intel compiler with vectorization guide. Something like -O3 -guide -guide-vec -parallel -qopt-report=5 -qopt-report-file=stdout pay attention to the -qopt-report=5 part, this is the reporting level when it starts to point out what exactly went wrong. But lets wait and see if we have more general answer which will not be bound to specific compiler vendor

EDIT001: I found this one being useful https://www.intel.com/content/dam/www/public/us/en/documents/guides/compiler-auto-vectorization-guide.pdf

Related