[cfe-dev] clang auto-vectorization feedback is confusing

Sean McBride via cfe-dev cfe-dev at lists.llvm.org
Thu Jun 30 13:13:56 PDT 2016


On Thu, 30 Jun 2016 09:53:41 -0700, Adam Nemet said:

>> It helpfully says it vectorized the inner loop, but says *nothing*
>about the outer loop.
>
>Currently the vectorizer does not visit outer loops and the diagnostics
>is emitted in the vectorizer so we don’t get a chance to report
>anything.  Can you please file a bug?

Done, see:
<https://llvm.org/bugs/show_bug.cgi?id=28374> 
<https://llvm.org/bugs/show_bug.cgi?id=28377>

>>  If I comment out the printf(), then it outputs nothing whatsoever. 
>Is this because earlier optimizer passes are basically destroying/
>transforming away the loop before the vectorizer sees it?
>
>Sort of, it’s because the loops are removed.  I am not sure what the
>expected behavior should be in this case...

Well, difficulties aside, from my perspective, it'd be nice if, for every loop in a compiled file, if clang could tell me:
 - this loop _was_ vectorized
 - this loop was _not_ vectorized because xyz
 - this loop was removed/optimized away/transformed/whatever

As it stands, one is left guessing in the last case.

>I am not sure there is anything beyond what you’re doing right now.  You
>could look at the internal debug dumps with a debug version of clang but
>probably the best thing to do is to file PRs on anything that does not
>make sense to you.

Thanks for the suggestion.  Relatedly, when faced with a diagnostic like "Loop not vectorized: unsafe dependent memory operations in loop", is there any reference that can help a layman understand what this is telling me exactly?  I STFW without many results.

>Thanks for reporting.

Also filed these:

Poor -Rpass-analysis=loop-vectorize diagnostic message for (acceptable) failure to vectorize Objective-C fast enumeration loops 
<https://llvm.org/bugs/show_bug.cgi?id=28375>
<rdar://27112452>>

-Rpass-missed=loop-vectorize says to use -Rpass-analysis=loop-vectorize even if I already am
<https://llvm.org/bugs/show_bug.cgi?id=28376>

Cheers,

Sean


More information about the cfe-dev mailing list