[cfe-dev] no -Rpass=loop-vectorize diagnostic in case of loop unrolling or -flto=thin

Alexander Droste via cfe-dev cfe-dev at lists.llvm.org
Tue Apr 9 23:06:16 PDT 2019

Hi everyone,

when vectorizing loops such as the following (Clang 8, -O3),

void vectorize(const float* a, const float* b, float* __restrict out) {
   for(int i = 0; i < 1024; ++i){
       out[i] = a[i] + b[i];

diagnostics triggered by -Rpass=loop-vectorize are not emitted in case ThinLTO
is enabled with -flto=thin. Using -flto=full the vectorization diagnostic is
still outlined.

Another instance in which the loop-vectorize diagnostic does not show up is in
case of loop unrolling, e.g. changing the 1024 to 8.

Looking at these cases with the opt-viewer.py tool, the loop unrolling case
seems no longer outlined as the SLP vectorizer takes over in place of the Loop
Vectorizer which I guess can be confusing from a user perspective when relying
on -Rpass=loop-vectorize. In case of ThinLTO, no vectorization diagnostic shows
up in the opt-viewer.py report.

In particular for the ThinLTO case, is there a way to retain the diagnostic that
vectorization took place?


More information about the cfe-dev mailing list