[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
Mon Apr 22 02:41:51 PDT 2019


Hi Teresa,

Thanks a lot for taking the time elaborate on this!

Cheers,
Alex

On Thu, Apr 18, 2019 at 01:48:02PM -0700, Teresa Johnson wrote:
> Unfortunately, the -Rpass options are not automatically passed down to the
> LTO backend threads (which are fired off via the linker). With full lto,
> you are still getting it since AFAIK it performs loop vectorization in the
> compile step (it is too expensive to move many optimizations to the full
> LTO backend which is serial). For ThinLTO this is performed in the backend.
> You can get the remarks from the LTO backends by passing the internal
> -pass-remarks=loop-vectorize to the backends via the linker. I.e. if using
> gold, it would be -Wl,-plugin-opt,-pass-remarks=loop-vectorize. The same
> mechanism should also work for lld.
>
> HTH,
> Teresa
>
> On Tue, Apr 9, 2019 at 11:06 PM Alexander Droste via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
> > 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?
> >
> > -Alex
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> >
>
>
> --
> Teresa Johnson |  Software Engineer |  tejohnson at google.com |



More information about the cfe-dev mailing list