no -Rpass=loop-vectorize diagnostic in case of loop unrolling or -flto=thin

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 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 report.

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


Hi Teresa,

Thanks a lot for taking the time elaborate on this!